[PATCH 01/05] percpu main.c setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Steven Rostedt <[email protected]>

Index: linux-2.6.17-rc1/init/main.c
===================================================================
--- linux-2.6.17-rc1.orig/init/main.c	2006-04-13 22:37:57.000000000 -0400
+++ linux-2.6.17-rc1/init/main.c	2006-04-14 11:46:51.000000000 -0400
@@ -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);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux