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:   Wed,  2 Aug 2017 16:52:18 +0800
From:   "Huang, Ying" <ying.huang@...el.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, Huang Ying <ying.huang@...el.com>,
        Tejun Heo <tj@...nel.org>, Christoph Lameter <cl@...ux.com>
Subject: [PATCH 1/3] percpu: Add alloc_percpu_aligned()

From: Huang Ying <ying.huang@...el.com>

To allocate percpu memory that is aligned with cache line size
dynamically.  We can statically allocate percpu memory that is aligned
with cache line size with DEFINE_PER_CPU_ALIGNED(), but we have no
correspondent API for dynamic allocation.

Signed-off-by: "Huang, Ying" <ying.huang@...el.com>
Cc: Tejun Heo <tj@...nel.org>
Cc: Christoph Lameter <cl@...ux.com>
---
 include/linux/percpu.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 491b3f5a5f8a..8b80a965d64a 100644
--- 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 */
-- 
2.13.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ