Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1702589
| From | "Huang\, Ying" <ying.huang@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/3] percpu: Add alloc_percpu_aligned() |
| Date | 2017-08-03 02:40 +0200 |
| Message-ID | <uaclb-xG-1@gated-at.bofh.it> (permalink) |
| References | <u9XFv-7As-5@gated-at.bofh.it> <u9XFw-7As-25@gated-at.bofh.it> <ua2lQ-281-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Christopher Lameter <cl@linux.com> writes: > On Wed, 2 Aug 2017, Huang, Ying wrote: > >> --- a/include/linux/percpu.h >> +++ b/include/linux/percpu.h >> @@ -129,5 +129,8 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr); >> #define alloc_percpu(type) \ >> (typeof(type) __percpu *)__alloc_percpu(sizeof(type), \ >> __alignof__(type)) >> +#define alloc_percpu_aligned(type) \ >> + ((typeof(type) __percpu *)__alloc_percpu(sizeof(type), \ >> + max_t(unsigned int, cache_line_size(), __alignof__(type)))) >> >> #endif /* __LINUX_PERCPU_H */ > > This is not needeed since alloc_percpu() already uses __alignof__(type). > > If you add an attribute to the definition of "type" that requires > cacheline alignmet (f.e. __cacheline_aligned) then alloc_percpu() will > align the allocation as you desire. OK. Best Regards, Huang, Ying
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 1/3] percpu: Add alloc_percpu_aligned() "Huang, Ying" <ying.huang@intel.com> - 2017-08-02 11:00 +0200
Re: [PATCH 1/3] percpu: Add alloc_percpu_aligned() Christopher Lameter <cl@linux.com> - 2017-08-02 16:00 +0200
Re: [PATCH 1/3] percpu: Add alloc_percpu_aligned() "Huang\, Ying" <ying.huang@intel.com> - 2017-08-03 02:40 +0200
csiph-web