percpu main.c setup
PATCH 1/5 percpu main.c setup
Copy the __per_cpu_offset array into the per_cpu_offset__##var variables.
Signed-off-by Steven Rostedt <[email protected]>
init/main.c +13 -5
@@ -324,9 +324,11 @@ static inline void smp_prepare_cpus(unsi#ifdef __GENERIC_PER_CPUunsigned long __per_cpu_offset[NR_CPUS ]__read_mostly ; -EXPORT_SYMBOL (__per_cpu_offset); +extern unsigned long *__per_cpu_offset_start, + *__per_cpu_offset_end; +static void __init setup_per_cpu_areas (void ) {unsigned long size, i;
@@ -335,12 +337,18 @@ static void __init setup_per_cpu_areas(v/* Copy section for each CPU (we discard the original) */ size =ALIGN (__per_cpu_end - __per_cpu_start,SMP_CACHE_BYTES ); -#ifdef CONFIG_MODULES -if (size <PERCPU_ENOUGH_ROOM ) - size =PERCPU_ENOUGH_ROOM ; -#endif ptr =alloc_bootmem (size * nr_possible_cpus); +#ifdef CONFIG_MODULES + { +unsigned long **offsets = &__per_cpu_offset_start; +printk ("setting up percpu from %p to %p with %p\n" , + &__per_cpu_offset_start, &__per_cpu_offset_end, + &__per_cpu_offset[0 ]); +for ( ; offsets < &__per_cpu_offset_end; offsets++) + *offsets = &__per_cpu_offset[0 ]; + } +#endif for_each_possible_cpu (i) { __per_cpu_offset[i] = ptr - __per_cpu_start;memcpy (ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);