--- arch/alpha/kernel/vmlinux.lds.S | 2 +- arch/arm/kernel/vmlinux.lds.S | 8 +++----- arch/frv/kernel/vmlinux.lds.S | 2 +- arch/ia64/kernel/setup.c | 5 ++--- arch/ia64/kernel/vmlinux.lds.S | 15 ++------------- arch/ia64/mm/contig.c | 6 +++--- arch/ia64/mm/discontig.c | 14 ++++++-------- arch/m32r/kernel/vmlinux.lds.S | 2 +- arch/mips/kernel/vmlinux.lds.S | 2 +- arch/parisc/kernel/vmlinux.lds.S | 2 +- arch/powerpc/kernel/setup_64.c | 6 +++--- arch/powerpc/kernel/vmlinux.lds.S | 8 +------- arch/ppc/kernel/vmlinux.lds.S | 2 +- arch/s390/kernel/vmlinux.lds.S | 2 +- arch/sh/kernel/vmlinux.lds.S | 2 +- arch/sh64/kernel/vmlinux.lds.S | 2 +- arch/sparc/kernel/vmlinux.lds.S | 2 +- arch/sparc64/kernel/smp.c | 4 ++-- arch/sparc64/kernel/vmlinux.lds.S | 2 +- arch/x86/kernel/setup64.c | 4 ++-- arch/x86/kernel/vmlinux_32.lds.S | 9 ++------- arch/x86/kernel/vmlinux_64.lds.S | 3 ++- arch/xtensa/kernel/vmlinux.lds.S | 2 +- include/asm-generic/percpu.h | 3 ++- include/asm-generic/sections.h | 4 ++-- include/asm-generic/vmlinux.lds.h | 13 ++++++++----- include/asm-ia64/sections.h | 3 ++- include/asm-um/common.lds.S | 11 +++++++---- include/linux/percpu.h | 2 +- init/main.c | 4 ++-- kernel/lockdep.c | 5 ++--- kernel/module.c | 6 +++--- 32 files changed, 69 insertions(+), 88 deletions(-) Index: linux-2.6/arch/alpha/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/alpha/kernel/vmlinux.lds.S 2007-11-24 10:17:45.176602755 -0800 +++ linux-2.6/arch/alpha/kernel/vmlinux.lds.S 2007-11-24 10:25:11.776100468 -0800 @@ -86,7 +86,7 @@ SECTIONS . = ALIGN(8); SECURITY_INIT - PERCPU(PAGE_SIZE) + PERCPU . = ALIGN(2 * PAGE_SIZE); __init_end = .; Index: linux-2.6/arch/arm/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/arm/kernel/vmlinux.lds.S 2007-11-24 10:17:45.185100677 -0800 +++ linux-2.6/arch/arm/kernel/vmlinux.lds.S 2007-11-24 10:25:11.780100462 -0800 @@ -63,11 +63,7 @@ SECTIONS usr/built-in.o(.init.ramfs) __initramfs_end = .; #endif - . = ALIGN(4096); - __per_cpu_start = .; - *(.data.percpu) - *(.data.percpu.shared_aligned) - __per_cpu_end = .; + #ifndef CONFIG_XIP_KERNEL __init_begin = _stext; *(.init.data) @@ -76,6 +72,8 @@ SECTIONS #endif } +PERCPU + /DISCARD/ : { /* Exit code and data */ *(.exit.text) *(.exit.data) Index: linux-2.6/arch/frv/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/frv/kernel/vmlinux.lds.S 2007-11-24 10:17:45.193100864 -0800 +++ linux-2.6/arch/frv/kernel/vmlinux.lds.S 2007-11-24 10:25:11.780100462 -0800 @@ -57,7 +57,7 @@ SECTIONS __alt_instructions_end = .; .altinstr_replacement : { *(.altinstr_replacement) } - PERCPU(4096) + PERCPU #ifdef CONFIG_BLK_DEV_INITRD . = ALIGN(4096); Index: linux-2.6/arch/ia64/kernel/setup.c =================================================================== --- linux-2.6.orig/arch/ia64/kernel/setup.c 2007-11-24 10:17:45.201100832 -0800 +++ linux-2.6/arch/ia64/kernel/setup.c 2007-11-24 10:25:11.780100462 -0800 @@ -864,8 +864,7 @@ cpu_init (void) * physical addresses of per cpu variables with a simple: * phys = ar.k3 + &per_cpu_var */ - ia64_set_kr(IA64_KR_PER_CPU_DATA, - ia64_tpa(cpu_data) - (long) __per_cpu_start); + ia64_set_kr(IA64_KR_PER_CPU_DATA, ia64_tpa(cpu_data)); get_max_cacheline_size(); @@ -875,7 +874,7 @@ cpu_init (void) * depends on the data returned by identify_cpu(). We break the dependency by * accessing cpu_data() through the canonical per-CPU address. */ - cpu_info = cpu_data + ((char *) &__ia64_per_cpu_var(cpu_info) - __per_cpu_start); + cpu_info = cpu_data + ((unsigned long)&per_cpu_var(cpu_info)); identify_cpu(cpu_info); #ifdef CONFIG_MCKINLEY Index: linux-2.6/arch/ia64/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/ia64/kernel/vmlinux.lds.S 2007-11-24 10:17:45.205100628 -0800 +++ linux-2.6/arch/ia64/kernel/vmlinux.lds.S 2007-11-24 10:25:11.780100462 -0800 @@ -206,22 +206,11 @@ SECTIONS .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { *(.data.cacheline_aligned) } - /* Per-cpu data: */ - percpu : { } :percpu - . = ALIGN(PERCPU_PAGE_SIZE); - __phys_per_cpu_start = .; - .data.percpu PERCPU_ADDR : AT(__phys_per_cpu_start - LOAD_OFFSET) - { - __per_cpu_start = .; - *(.data.percpu) - *(.data.percpu.shared_aligned) - __per_cpu_end = .; - } - . = __phys_per_cpu_start + PERCPU_PAGE_SIZE; /* ensure percpu data fits + PERCPU + . = __per_cpu_load + PERCPU_PAGE_SIZE; /* ensure percpu data fits * into percpu page size */ - data : { } :data .data : AT(ADDR(.data) - LOAD_OFFSET) { DATA_DATA Index: linux-2.6/arch/ia64/mm/contig.c =================================================================== --- linux-2.6.orig/arch/ia64/mm/contig.c 2007-11-24 10:17:45.233600570 -0800 +++ linux-2.6/arch/ia64/mm/contig.c 2007-11-24 10:25:11.780100462 -0800 @@ -167,13 +167,13 @@ per_cpu_init (void) if (first_time) { first_time=0; for (cpu = 0; cpu < NR_CPUS; cpu++) { - memcpy(cpu_data, __phys_per_cpu_start, __per_cpu_end - __per_cpu_start); - __per_cpu_offset[cpu] = (char *) cpu_data - __per_cpu_start; + memcpy(cpu_data, __per_cpu_load, __per_cpu_size); + __per_cpu_offset[cpu] = cpu_data; cpu_data += PERCPU_PAGE_SIZE; per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu]; } } - return __per_cpu_start + __per_cpu_offset[smp_processor_id()]; + return (void *)__per_cpu_offset[smp_processor_id()]; } static inline void Index: linux-2.6/arch/ia64/mm/discontig.c =================================================================== --- linux-2.6.orig/arch/ia64/mm/discontig.c 2007-11-24 10:17:45.245850789 -0800 +++ linux-2.6/arch/ia64/mm/discontig.c 2007-11-24 10:25:11.792100328 -0800 @@ -144,10 +144,8 @@ static void *per_cpu_node_setup(void *cp for (cpu = 0; cpu < NR_CPUS; cpu++) { if (node == node_cpuid[cpu].nid) { - memcpy(__va(cpu_data), __phys_per_cpu_start, - __per_cpu_end - __per_cpu_start); - __per_cpu_offset[cpu] = (char*)__va(cpu_data) - - __per_cpu_start; + memcpy(__va(cpu_data), __per_cpu_load, __per_cpu_size); + __per_cpu_offset[cpu] = (unsigned long)__va(cpu_data); cpu_data += PERCPU_PAGE_SIZE; } } @@ -354,8 +352,8 @@ static void __init initialize_pernode_da struct cpuinfo_ia64 *cpu0_cpu_info; cpu = 0; node = node_cpuid[cpu].nid; - cpu0_cpu_info = (struct cpuinfo_ia64 *)(__phys_per_cpu_start + - ((char *)&per_cpu__cpu_info - __per_cpu_start)); + cpu0_cpu_info = (struct cpuinfo_ia64 *)(__per_cpu_load + + ((unsigned long)&per_cpu__cpu_info)); cpu0_cpu_info->node_data = mem_data[node].node_data; } #endif /* CONFIG_SMP */ @@ -495,7 +493,7 @@ void __cpuinit *per_cpu_init(void) if (smp_processor_id() != 0) - return __per_cpu_start + __per_cpu_offset[smp_processor_id()]; + return (void *)__per_cpu_offset[smp_processor_id()]; if (first_time) { first_time = 0; @@ -503,7 +501,7 @@ void __cpuinit *per_cpu_init(void) per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu]; } - return __per_cpu_start + __per_cpu_offset[smp_processor_id()]; + return (void *)__per_cpu_offset[smp_processor_id()]; } #endif /* CONFIG_SMP */ Index: linux-2.6/arch/m32r/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/m32r/kernel/vmlinux.lds.S 2007-11-24 10:17:45.253850804 -0800 +++ linux-2.6/arch/m32r/kernel/vmlinux.lds.S 2007-11-24 10:25:11.800100349 -0800 @@ -110,7 +110,7 @@ SECTIONS __initramfs_end = .; #endif - PERCPU(4096) + PERCPU . = ALIGN(4096); __init_end = .; /* freed after init ends here */ Index: linux-2.6/arch/mips/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/mips/kernel/vmlinux.lds.S 2007-11-24 10:17:45.261850811 -0800 +++ linux-2.6/arch/mips/kernel/vmlinux.lds.S 2007-11-24 10:25:11.800100349 -0800 @@ -157,7 +157,7 @@ SECTIONS __initramfs_end = .; } #endif - PERCPU(_PAGE_SIZE) + PERCPU . = ALIGN(_PAGE_SIZE); __init_end = .; /* freed after init ends here */ Index: linux-2.6/arch/parisc/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/parisc/kernel/vmlinux.lds.S 2007-11-24 10:17:45.269850761 -0800 +++ linux-2.6/arch/parisc/kernel/vmlinux.lds.S 2007-11-24 10:25:11.800100349 -0800 @@ -229,7 +229,7 @@ SECTIONS } #endif - PERCPU(PAGE_SIZE) + PERCPU . = ALIGN(PAGE_SIZE); __init_end = .; /* freed after init ends here */ Index: linux-2.6/arch/powerpc/kernel/setup_64.c =================================================================== --- linux-2.6.orig/arch/powerpc/kernel/setup_64.c 2007-11-24 10:17:45.273850716 -0800 +++ linux-2.6/arch/powerpc/kernel/setup_64.c 2007-11-24 10:25:11.800100349 -0800 @@ -581,7 +581,7 @@ void __init setup_per_cpu_areas(void) char *ptr; /* Copy section for each CPU (we discard the original) */ - size = ALIGN(__per_cpu_end - __per_cpu_start, PAGE_SIZE); + size = ALIGN(__per_cpu_size, PAGE_SIZE); #ifdef CONFIG_MODULES if (size < PERCPU_ENOUGH_ROOM) size = PERCPU_ENOUGH_ROOM; @@ -592,8 +592,8 @@ void __init setup_per_cpu_areas(void) if (!ptr) panic("Cannot allocate cpu data for CPU %d\n", i); - paca[i].data_offset = ptr - __per_cpu_start; - memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); + paca[i].data_offset = (unsigned long)ptr; + memcpy(ptr, __per_cpu_load, __per_cpu_size); } /* Now that per_cpu is setup, initialize cpu_sibling_map */ Index: linux-2.6/arch/powerpc/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/powerpc/kernel/vmlinux.lds.S 2007-11-24 10:17:45.281850963 -0800 +++ linux-2.6/arch/powerpc/kernel/vmlinux.lds.S 2007-11-24 10:25:11.800100349 -0800 @@ -143,13 +143,7 @@ SECTIONS __initramfs_end = .; } #endif - . = ALIGN(PAGE_SIZE); - .data.percpu : { - __per_cpu_start = .; - *(.data.percpu) - *(.data.percpu.shared_aligned) - __per_cpu_end = .; - } + PERCPU . = ALIGN(8); .machine.desc : { Index: linux-2.6/arch/ppc/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/ppc/kernel/vmlinux.lds.S 2007-11-24 10:17:45.289850724 -0800 +++ linux-2.6/arch/ppc/kernel/vmlinux.lds.S 2007-11-24 10:25:11.800100349 -0800 @@ -132,7 +132,7 @@ SECTIONS __ftr_fixup : { *(__ftr_fixup) } __stop___ftr_fixup = .; - PERCPU(4096) + PERCPU #ifdef CONFIG_BLK_DEV_INITRD . = ALIGN(4096); Index: linux-2.6/arch/s390/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/s390/kernel/vmlinux.lds.S 2007-11-24 10:17:45.297850773 -0800 +++ linux-2.6/arch/s390/kernel/vmlinux.lds.S 2007-11-24 10:25:11.800100349 -0800 @@ -134,7 +134,7 @@ SECTIONS } #endif - PERCPU(PAGE_SIZE) + PERCPU . = ALIGN(PAGE_SIZE); __init_end = .; /* freed after init ends here */ Index: linux-2.6/arch/sh/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/sh/kernel/vmlinux.lds.S 2007-11-24 10:17:45.305851107 -0800 +++ linux-2.6/arch/sh/kernel/vmlinux.lds.S 2007-11-24 10:25:11.800100349 -0800 @@ -102,7 +102,7 @@ SECTIONS .machvec.init : { *(.machvec.init) } __machvec_end = .; - PERCPU(PAGE_SIZE) + PERCPU /* * .exit.text is discarded at runtime, not link time, to deal with Index: linux-2.6/arch/sh64/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/sh64/kernel/vmlinux.lds.S 2007-11-24 10:17:45.313850759 -0800 +++ linux-2.6/arch/sh64/kernel/vmlinux.lds.S 2007-11-24 10:25:11.800100349 -0800 @@ -80,7 +80,7 @@ SECTIONS . = ALIGN(PAGE_SIZE); .data.page_aligned : C_PHYS(.data.page_aligned) { *(.data.page_aligned) } - PERCPU(PAGE_SIZE) + PERCPU . = ALIGN(L1_CACHE_BYTES); .data.cacheline_aligned : C_PHYS(.data.cacheline_aligned) { *(.data.cacheline_aligned) } Index: linux-2.6/arch/sparc/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/sparc/kernel/vmlinux.lds.S 2007-11-24 10:17:45.325850760 -0800 +++ linux-2.6/arch/sparc/kernel/vmlinux.lds.S 2007-11-24 10:25:11.804350840 -0800 @@ -82,7 +82,7 @@ SECTIONS } #endif - PERCPU(PAGE_SIZE) + PERCPU . = ALIGN(PAGE_SIZE); __init_end = .; . = ALIGN(32); Index: linux-2.6/arch/sparc64/kernel/smp.c =================================================================== --- linux-2.6.orig/arch/sparc64/kernel/smp.c 2007-11-24 10:17:45.329850818 -0800 +++ linux-2.6/arch/sparc64/kernel/smp.c 2007-11-24 10:25:11.804350840 -0800 @@ -1435,10 +1435,10 @@ void __init real_setup_per_cpu_areas(voi ptr = alloc_bootmem_pages(size * NR_CPUS); - __per_cpu_base = ptr - __per_cpu_start; + __per_cpu_base = (unsigned long)ptr; for (i = 0; i < NR_CPUS; i++, ptr += size) - memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); + memcpy(ptr, __per_cpu_load, __per_cpu_size); /* Setup %g5 for the boot cpu. */ __local_per_cpu_offset = __per_cpu_offset(smp_processor_id()); Index: linux-2.6/arch/sparc64/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/sparc64/kernel/vmlinux.lds.S 2007-11-24 10:17:45.337851080 -0800 +++ linux-2.6/arch/sparc64/kernel/vmlinux.lds.S 2007-11-24 10:25:11.804350840 -0800 @@ -119,7 +119,7 @@ SECTIONS } #endif - PERCPU(PAGE_SIZE) + PERCPU . = ALIGN(PAGE_SIZE); __init_end = .; Index: linux-2.6/arch/x86/kernel/setup64.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/setup64.c 2007-11-24 10:17:45.345851000 -0800 +++ linux-2.6/arch/x86/kernel/setup64.c 2007-11-24 10:25:11.804350840 -0800 @@ -109,8 +109,8 @@ void __init setup_per_cpu_areas(void) } if (!ptr) panic("Cannot allocate cpu data for CPU %d\n", i); - cpu_pda(i)->data_offset = ptr - __per_cpu_start; - memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); + cpu_pda(i)->data_offset = (unsigned long)ptr; + memcpy(ptr, __per_cpu_load, __per_cpu_size); } } Index: linux-2.6/arch/x86/kernel/vmlinux_32.lds.S =================================================================== --- linux-2.6.orig/arch/x86/kernel/vmlinux_32.lds.S 2007-11-24 10:17:45.349850772 -0800 +++ linux-2.6/arch/x86/kernel/vmlinux_32.lds.S 2007-11-24 10:25:11.804350840 -0800 @@ -29,6 +29,7 @@ jiffies = jiffies_64; PHDRS { text PT_LOAD FLAGS(5); /* R_E */ + percpu PT_LOAD FLAGS(4); /* R__ */ data PT_LOAD FLAGS(7); /* RWE */ note PT_NOTE FLAGS(0); /* ___ */ } @@ -179,13 +180,7 @@ SECTIONS __initramfs_end = .; } #endif - . = ALIGN(4096); - .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { - __per_cpu_start = .; - *(.data.percpu) - *(.data.percpu.shared_aligned) - __per_cpu_end = .; - } + PERCPU . = ALIGN(4096); /* freed after init ends here */ Index: linux-2.6/arch/x86/kernel/vmlinux_64.lds.S =================================================================== --- linux-2.6.orig/arch/x86/kernel/vmlinux_64.lds.S 2007-11-24 10:17:45.357850853 -0800 +++ linux-2.6/arch/x86/kernel/vmlinux_64.lds.S 2007-11-24 10:25:11.804350840 -0800 @@ -16,6 +16,7 @@ jiffies_64 = jiffies; _proxy_pda = 1; PHDRS { text PT_LOAD FLAGS(5); /* R_E */ + percpu PT_LOAD FLAGS(4); /* R__ */ data PT_LOAD FLAGS(7); /* RWE */ user PT_LOAD FLAGS(7); /* RWE */ data.init PT_LOAD FLAGS(7); /* RWE */ @@ -203,7 +204,7 @@ SECTIONS __initramfs_end = .; #endif - PERCPU(4096) + PERCPU . = ALIGN(4096); __init_end = .; Index: linux-2.6/arch/xtensa/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.orig/arch/xtensa/kernel/vmlinux.lds.S 2007-11-24 10:17:45.369850794 -0800 +++ linux-2.6/arch/xtensa/kernel/vmlinux.lds.S 2007-11-24 10:25:11.804350840 -0800 @@ -191,7 +191,7 @@ SECTIONS __initramfs_end = .; #endif - PERCPU(4096) + PERCPU /* We need this dummy segment here */ Index: linux-2.6/include/asm-generic/sections.h =================================================================== --- linux-2.6.orig/include/asm-generic/sections.h 2007-11-24 10:17:45.373850903 -0800 +++ linux-2.6/include/asm-generic/sections.h 2007-11-24 10:25:11.804350840 -0800 @@ -10,8 +10,8 @@ extern char __init_begin[], __init_end[] extern char _sinittext[], _einittext[]; extern char _sextratext[] __attribute__((weak)); extern char _eextratext[] __attribute__((weak)); -extern char _end[]; -extern char __per_cpu_start[], __per_cpu_end[]; +extern char _end[], __per_cpu_load[]; +extern unsigned long __per_cpu_size; extern char __kprobes_text_start[], __kprobes_text_end[]; extern char __initdata_begin[], __initdata_end[]; extern char __start_rodata[], __end_rodata[]; Index: linux-2.6/include/asm-generic/vmlinux.lds.h =================================================================== --- linux-2.6.orig/include/asm-generic/vmlinux.lds.h 2007-11-24 10:17:45.381851009 -0800 +++ linux-2.6/include/asm-generic/vmlinux.lds.h 2007-11-24 10:25:11.804350840 -0800 @@ -255,11 +255,14 @@ *(.initcall7.init) \ *(.initcall7s.init) -#define PERCPU(align) \ - . = ALIGN(align); \ - __per_cpu_start = .; \ - .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ +#define PERCPU \ + percpu : { } :percpu \ + __per_cpu_load = .; \ + .data.percpu 0 : AT(__per_cpu_load - LOAD_OFFSET) { \ *(.data.percpu) \ *(.data.percpu.shared_aligned) \ + __per_cpu_size = .; \ } \ - __per_cpu_end = .; + . = __per_cpu_load + __per_cpu_size; \ + data : { } : data + Index: linux-2.6/include/asm-ia64/sections.h =================================================================== --- linux-2.6.orig/include/asm-ia64/sections.h 2007-11-24 10:17:45.393850715 -0800 +++ linux-2.6/include/asm-ia64/sections.h 2007-11-24 10:25:11.804350840 -0800 @@ -8,7 +8,8 @@ #include -extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[]; +extern char __per_cpu_load[]; +extern unsigned long __per_cpu_size; extern char __start___vtop_patchlist[], __end___vtop_patchlist[]; extern char __start___mckinley_e9_bundles[], __end___mckinley_e9_bundles[]; extern char __start___phys_stack_reg_patchlist[], __end___phys_stack_reg_patchlist[]; Index: linux-2.6/include/asm-um/common.lds.S =================================================================== --- linux-2.6.orig/include/asm-um/common.lds.S 2007-11-24 10:17:45.401850662 -0800 +++ linux-2.6/include/asm-um/common.lds.S 2007-11-24 10:25:11.804350840 -0800 @@ -49,12 +49,15 @@ } . = ALIGN(32); - .data.percpu : { - __per_cpu_start = . ; + percpu: { } :percpu + __per_cpu_load = . ; + .data.percpu 0 : { *(.data.percpu) - __per_cpu_end = . ; + __per_cpu_size = . ; } - + . = __per_cpu_load + __per_cpu_size; + data: { } :data + .initcall.init : { __initcall_start = .; INITCALLS Index: linux-2.6/include/linux/percpu.h =================================================================== --- linux-2.6.orig/include/linux/percpu.h 2007-11-24 10:18:29.736600559 -0800 +++ linux-2.6/include/linux/percpu.h 2007-11-24 10:25:11.804350840 -0800 @@ -29,7 +29,7 @@ #endif #define PERCPU_ENOUGH_ROOM \ - (__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE) + (__per_cpu_size + PERCPU_MODULE_RESERVE) #endif /* PERCPU_ENOUGH_ROOM */ /* Index: linux-2.6/init/main.c =================================================================== --- linux-2.6.orig/init/main.c 2007-11-24 10:20:15.524100551 -0800 +++ linux-2.6/init/main.c 2007-11-24 10:25:11.804350840 -0800 @@ -379,8 +379,8 @@ static void __init setup_per_cpu_areas(v ptr = alloc_bootmem_pages(size * nr_possible_cpus); for_each_possible_cpu(i) { - __per_cpu_offset[i] = ptr - __per_cpu_start; - memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); + __per_cpu_offset[i] = (unsigned long)ptr; + memcpy(ptr, __per_cpu_load, __per_cpu_size); ptr += size; } } Index: linux-2.6/kernel/lockdep.c =================================================================== --- linux-2.6.orig/kernel/lockdep.c 2007-11-24 10:17:45.421851001 -0800 +++ linux-2.6/kernel/lockdep.c 2007-11-24 10:25:11.804350840 -0800 @@ -609,9 +609,8 @@ static int static_obj(void *obj) * percpu var? */ for_each_possible_cpu(i) { - start = (unsigned long) &__per_cpu_start + per_cpu_offset(i); - end = (unsigned long) &__per_cpu_start + PERCPU_ENOUGH_ROOM - + per_cpu_offset(i); + start = per_cpu_offset(i); + end = start + PERCPU_ENOUGH_ROOM; if ((addr >= start) && (addr < end)) return 1; Index: linux-2.6/kernel/module.c =================================================================== --- linux-2.6.orig/kernel/module.c 2007-11-24 10:17:45.429850848 -0800 +++ linux-2.6/kernel/module.c 2007-11-24 10:25:11.808351239 -0800 @@ -352,7 +352,7 @@ static void *percpu_modalloc(unsigned lo align = PAGE_SIZE; } - ptr = __per_cpu_start; + ptr = NULL; for (i = 0; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) { /* Extra for alignment requirement. */ extra = ALIGN((unsigned long)ptr, align) - (unsigned long)ptr; @@ -387,7 +387,7 @@ static void *percpu_modalloc(unsigned lo static void percpu_modfree(void *freeme) { unsigned int i; - void *ptr = __per_cpu_start + block_size(pcpu_size[0]); + void *ptr = NULL + block_size(pcpu_size[0]); /* First entry is core kernel percpu data. */ for (i = 1; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) { @@ -438,7 +438,7 @@ static int percpu_modinit(void) pcpu_size = kmalloc(sizeof(pcpu_size[0]) * pcpu_num_allocated, GFP_KERNEL); /* Static in-kernel percpu data (used). */ - pcpu_size[0] = -(__per_cpu_end-__per_cpu_start); + pcpu_size[0] = -__per_cpu_size; /* Free room. */ pcpu_size[1] = PERCPU_ENOUGH_ROOM + pcpu_size[0]; if (pcpu_size[1] < 0) { Index: linux-2.6/include/asm-generic/percpu.h =================================================================== --- linux-2.6.orig/include/asm-generic/percpu.h 2007-11-24 10:19:00.220100299 -0800 +++ linux-2.6/include/asm-generic/percpu.h 2007-11-24 10:25:11.808351239 -0800 @@ -33,7 +33,8 @@ extern unsigned long __per_cpu_offset[NR * Only S390 provides its own means of moving the pointer. */ #ifndef SHIFT_PTR -#define SHIFT_PTR(__p, __offset) RELOC_HIDE((__p), (__offset)) +#define SHIFT_PTR(__p, __offset) \ + ((__typeof(__p))((void *)(__p) + (__offset))) #endif /*