lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ