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]
Message-ID: <alpine.DEB.2.20.1708020847360.23703@nuc-kabylake>
Date:   Wed, 2 Aug 2017 08:50:44 -0500 (CDT)
From:   Christopher Lameter <cl@...ux.com>
To:     "Huang, Ying" <ying.huang@...el.com>
cc:     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()

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.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ