Name: Unification of per-cpu headers for SMP Author: Rusty Russell Status: Trivial Depends: Percpu/percpu-up-unify.patch.gz There's really only one sane way to implement accessing other CPU's variables, there's no real reason for archs to use a method other than __per_cpu_offset[], so move that from asm-*/percpu.h to linux/percpu.h. Index: linux-2.6.11-rc1-bk1-Percpu/include/asm-ia64/percpu.h =================================================================== --- linux-2.6.11-rc1-bk1-Percpu.orig/include/asm-ia64/percpu.h 2004-02-18 23:54:32.000000000 +1100 +++ linux-2.6.11-rc1-bk1-Percpu/include/asm-ia64/percpu.h 2005-01-14 13:19:04.681626896 +1100 @@ -35,9 +35,6 @@ * external routine, to avoid include-hell. */ #ifdef CONFIG_SMP - -extern unsigned long __per_cpu_offset[NR_CPUS]; - /* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */ DECLARE_PER_CPU(unsigned long, local_per_cpu_offset); Index: linux-2.6.11-rc1-bk1-Percpu/init/main.c =================================================================== --- linux-2.6.11-rc1-bk1-Percpu.orig/init/main.c 2005-01-13 12:11:11.000000000 +1100 +++ linux-2.6.11-rc1-bk1-Percpu/init/main.c 2005-01-14 13:19:04.768613672 +1100 @@ -305,11 +305,10 @@ #else -#ifdef __GENERIC_PER_CPU unsigned long __per_cpu_offset[NR_CPUS]; - EXPORT_SYMBOL(__per_cpu_offset); +#ifdef __GENERIC_PER_CPU static void __init setup_per_cpu_areas(void) { unsigned long size, i; Index: linux-2.6.11-rc1-bk1-Percpu/arch/ia64/kernel/setup.c =================================================================== --- linux-2.6.11-rc1-bk1-Percpu.orig/arch/ia64/kernel/setup.c 2005-01-14 11:08:00.000000000 +1100 +++ linux-2.6.11-rc1-bk1-Percpu/arch/ia64/kernel/setup.c 2005-01-14 13:19:04.893594672 +1100 @@ -56,11 +56,6 @@ # error "struct cpuinfo_ia64 too big!" #endif -#ifdef CONFIG_SMP -unsigned long __per_cpu_offset[NR_CPUS]; -EXPORT_SYMBOL(__per_cpu_offset); -#endif - DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info); DEFINE_PER_CPU(unsigned long, local_per_cpu_offset); DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8); Index: linux-2.6.11-rc1-bk1-Percpu/include/linux/percpu.h =================================================================== --- linux-2.6.11-rc1-bk1-Percpu.orig/include/linux/percpu.h 2004-10-19 14:34:22.000000000 +1000 +++ linux-2.6.11-rc1-bk1-Percpu/include/linux/percpu.h 2005-01-14 13:19:04.985580688 +1100 @@ -16,6 +16,9 @@ #define put_cpu_var(var) preempt_enable() #ifdef CONFIG_SMP +/* var is in discarded region: offset to particular copy we want */ +#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) +extern unsigned long __per_cpu_offset[NR_CPUS]; struct percpu_data { void *ptrs[NR_CPUS]; Index: linux-2.6.11-rc1-bk1-Percpu/include/asm-generic/percpu.h =================================================================== --- linux-2.6.11-rc1-bk1-Percpu.orig/include/asm-generic/percpu.h 2004-02-04 15:39:09.000000000 +1100 +++ linux-2.6.11-rc1-bk1-Percpu/include/asm-generic/percpu.h 2005-01-14 13:19:05.099563360 +1100 @@ -5,14 +5,10 @@ #define __GENERIC_PER_CPU #ifdef CONFIG_SMP -extern unsigned long __per_cpu_offset[NR_CPUS]; - /* Separate out the type, so (int[3], foo) works. */ #define DEFINE_PER_CPU(type, name) \ __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name -/* var is in discarded region: offset to particular copy we want */ -#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) #define __get_cpu_var(var) per_cpu(var, smp_processor_id()) /* A macro to avoid #include hell... */