There needs to be a way to determine the offset for the CPU ops of per cpu variables. The offset is simply the address of the variable. But we do not want to code ugly things like CPU_READ(per_cpu__statistics) in the core. So define a new helper per_cpu_var(var) that simply adds the per_cpu__ prefix. Signed-off-by: Christoph Lameter --- include/asm-x86/percpu_64.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) Index: linux-2.6/include/asm-x86/percpu_64.h =================================================================== --- linux-2.6.orig/include/asm-x86/percpu_64.h 2007-11-19 16:17:21.477639855 -0800 +++ linux-2.6/include/asm-x86/percpu_64.h 2007-11-19 16:17:23.942140438 -0800 @@ -14,29 +14,35 @@ /* Legacy: lockdep in the core kernel uses this */ #define per_cpu_offset(cpu) CPU_OFFSET(cpu) +/* + * Needed in order to be able to pass per cpu variables to CPU_xx + * macros. Another solution may be to simply drop the prefix? + */ +#define per_cpu_var(var) per_cpu__##var + /* Separate out the type, so (int[3], foo) works. */ #define DEFINE_PER_CPU(type, name) \ - __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name + __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu_var(name) #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ __attribute__((__section__(".data.percpu.shared_aligned"))) \ - __typeof__(type) per_cpu__##name \ + __typeof__(type) per_cpu_var(name) \ ____cacheline_internodealigned_in_smp #define DEFINE_PER_CPU_FIRST(type, name) \ __attribute__((__section__(".data.percpu.first"))) \ - __typeof__(type) per_cpu__##name + __typeof__(type) per_cpu_var(name) /* var is in discarded region: offset to particular copy we want */ #define per_cpu(var, cpu) (*({ \ extern int simple_identifier_##var(void); \ - CPU_PTR(&per_cpu__##var, (cpu)); })) + CPU_PTR(&per_cpu_var(var), (cpu)); })) #define __get_cpu_var(var) (*({ \ extern int simple_identifier_##var(void); \ - THIS_CPU(&per_cpu__##var); })) + THIS_CPU(&per_cpu_var(var)); })) #define __raw_get_cpu_var(var) (*({ \ extern int simple_identifier_##var(void); \ - __THIS_CPU(&per_cpu__##var); })) + __THIS_CPU(&per_cpu_var(var)); })) /* A macro to avoid #include hell... */ #define percpu_modcopy(pcpudst, src, size) \ -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/