Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

percpu: repurpose __percpu tag as a named address space qualifier

The patch introduces __percpu_qual define and repurposes __percpu tag as a
named address space qualifier using the new define.

Arches can now conditionally define __percpu_qual as their named address
space qualifier for percpu variables.

Link: https://lkml.kernel.org/r/20250127160709.80604-6-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Acked-by: Nadav Amit <nadav.amit@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Waiman Long <longman@redhat.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Uros Bizjak and committed by
Andrew Morton
6cea5ae7 6a39fe05

+14 -1
+13
include/asm-generic/percpu.h
··· 6 6 #include <linux/threads.h> 7 7 #include <linux/percpu-defs.h> 8 8 9 + /* 10 + * __percpu_qual is the qualifier for the percpu named address space. 11 + * 12 + * Most arches use generic named address space for percpu variables but 13 + * some arches define percpu variables in different named address space 14 + * (on the x86 arch, percpu variable may be declared as being relative 15 + * to the %fs or %gs segments using __seg_fs or __seg_gs named address 16 + * space qualifier). 17 + */ 18 + #ifndef __percpu_qual 19 + # define __percpu_qual 20 + #endif 21 + 9 22 #ifdef CONFIG_SMP 10 23 11 24 /*
+1 -1
include/linux/compiler_types.h
··· 57 57 # define __user BTF_TYPE_TAG(user) 58 58 # endif 59 59 # define __iomem 60 - # define __percpu BTF_TYPE_TAG(percpu) 60 + # define __percpu __percpu_qual BTF_TYPE_TAG(percpu) 61 61 # define __rcu BTF_TYPE_TAG(rcu) 62 62 63 63 # define __chk_user_ptr(x) (void)0