Skip to contentSkip to conversation

percpu main.c setup

PATCH In review Steven Rostedt 1 participant 1 message Apr 14, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 percpu main.c setup

Copy the __per_cpu_offset array into the per_cpu_offset__##var variables.

init/main.c +13 -5
Index: linux-2.6.17-rc1/init/main.c
===================================================================
@@ -324,9 +324,11 @@ static inline void smp_prepare_cpus(unsi
 
 #ifdef __GENERIC_PER_CPU
 unsigned 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);