[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87tw1p5w31.fsf@yhuang-dev.intel.com>
Date: Thu, 03 Aug 2017 08:33:22 +0800
From: "Huang\, Ying" <ying.huang@...el.com>
To: Christopher Lameter <cl@...ux.com>
Cc: "Huang\, Ying" <ying.huang@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
<linux-kernel@...r.kernel.org>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH 1/3] percpu: Add alloc_percpu_aligned()
Christopher Lameter <cl@...ux.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
Powered by blists - more mailing lists