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

x86/percpu: Refer __percpu_prefix to __force_percpu_prefix

Refer __percpu_prefix to __force_percpu_prefix to avoid duplicate
definition. While there, slightly reorder definitions to a more
logical sequence, remove unneeded double quotes and move misplaced
comment to the right place.

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Link: https://lore.kernel.org/r/20250411093130.81389-1-ubizjak@gmail.com

authored by

Uros Bizjak and committed by
Ingo Molnar
d51faee4 7615b94b

+11 -9
+11 -9
arch/x86/include/asm/percpu.h
··· 29 29 30 30 #ifdef CONFIG_SMP 31 31 32 + #define __force_percpu_prefix "%%"__stringify(__percpu_seg)":" 33 + 32 34 #ifdef CONFIG_CC_HAS_NAMED_AS 33 35 34 36 #ifdef __CHECKER__ ··· 38 36 # define __seg_fs __attribute__((address_space(__seg_fs))) 39 37 #endif 40 38 39 + #define __percpu_prefix 41 40 #define __percpu_seg_override CONCATENATE(__seg_, __percpu_seg) 42 - #define __percpu_prefix "" 43 41 44 42 #else /* !CONFIG_CC_HAS_NAMED_AS: */ 45 43 44 + #define __percpu_prefix __force_percpu_prefix 46 45 #define __percpu_seg_override 47 - #define __percpu_prefix "%%"__stringify(__percpu_seg)":" 48 46 49 47 #endif /* CONFIG_CC_HAS_NAMED_AS */ 50 - 51 - #define __force_percpu_prefix "%%"__stringify(__percpu_seg)":" 52 - #define __my_cpu_offset this_cpu_read(this_cpu_off) 53 48 54 49 /* 55 50 * Compared to the generic __my_cpu_offset version, the following 56 51 * saves one instruction and avoids clobbering a temp register. 57 - * 52 + */ 53 + #define __my_cpu_offset this_cpu_read(this_cpu_off) 54 + 55 + /* 58 56 * arch_raw_cpu_ptr should not be used in 32-bit VDSO for a 64-bit 59 57 * kernel, because games are played with CONFIG_X86_64 there and 60 58 * sizeof(this_cpu_off) becames 4. ··· 79 77 80 78 #else /* !CONFIG_SMP: */ 81 79 80 + #define __force_percpu_prefix 81 + #define __percpu_prefix 82 82 #define __percpu_seg_override 83 - #define __percpu_prefix "" 84 - #define __force_percpu_prefix "" 85 83 86 84 #define PER_CPU_VAR(var) (var)__percpu_rel 87 85 ··· 99 97 # define __my_cpu_var(var) (*__my_cpu_ptr(&(var))) 100 98 #endif 101 99 102 - #define __percpu_arg(x) __percpu_prefix "%" #x 103 100 #define __force_percpu_arg(x) __force_percpu_prefix "%" #x 101 + #define __percpu_arg(x) __percpu_prefix "%" #x 104 102 105 103 /* 106 104 * For arch-specific code, we can use direct single-insn ops (they