Skip to contentSkip to conversation

setup_per_cpu_areas in 2.5.8pre3

PATCH In review [email protected] 2 participants 2 messages Apr 14, 2002 – Apr 17, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 setup_per_cpu_areas in 2.5.8pre3

Now that I am writing anyway, one of the changes I needed to compile 2.5.8pre3 is the following.

main.c renamed from main.c~ +3 -1
@@ -270,7 +270,9 @@
 #else
 #define smp_init()	do { } while (0)
 #endif
-
+static inline void setup_per_cpu_areas(void)
+{
+}
 #else
 
 #ifdef __GENERIC_PER_CPU

There is a nest of #ifdef's there, and in some branches setup_per_cpu_areas() is not defined.

Of course the real fix is to remove the #ifdef's, maybe using a weak symbol instead, or some other construction that defines an empty default that can be replaced by an actual routine.

Andries

#1 lore raw
Quoted 3 lines · On Sun, 14 Apr 2002 21:15:29 GMT [email protected] wrote:

Now that I am writing anyway, one of the changes I needed to compile 2.5.8pre3 is the following.

Yeah, better patch below (__GENERIC_PER_CPU implies SMP anyway).

Quoted 4 lines

Of course the real fix is to remove the #ifdef's, maybe using a weak symbol instead, or some other construction that defines an empty default that can be replaced by an actual routine.

Not unless you make it as readable as the current code. Having magic appearing functions sounds cool, but beware that the cure might be worse than the disease.

Yes, I know this patch looks like I'm moving smp_init(), but really it's moving the #ifdef __GENERIC_PER_CPU bit past the SMP #endif.

Rusty.

Signature · 43 lines
   there are those who do and those who hang on and you don't see too
   many doers quoting their contemporaries.  -- Larry McVoy
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.8/init/main.c working-2.5.8-percpu/init/main.c
--- linux-2.5.8/init/main.c	Mon Apr 15 11:47:50 2002
+++ working-2.5.8-percpu/init/main.c	Tue Apr 16 21:11:50 2002
@@ -274,6 +274,18 @@
 
 #else
 
+/* Called by boot processor to activate the rest. */
+static void __init smp_init(void)
+{
+	/* Get other processors into their bootup holding patterns. */
+	smp_boot_cpus();
+
+	smp_threads_ready=1;
+	smp_commence();
+}
+
+#endif
+
 #ifdef __GENERIC_PER_CPU
 unsigned long __per_cpu_offset[NR_CPUS];
 
@@ -301,18 +313,6 @@
 {
 }
 #endif /* !__GENERIC_PER_CPU */
-
-/* Called by boot processor to activate the rest. */
-static void __init smp_init(void)
-{
-	/* Get other processors into their bootup holding patterns. */
-	smp_boot_cpus();
-
-	smp_threads_ready=1;
-	smp_commence();
-}
-
-#endif
 
 /*
  * We need to finalize in a non-__init function or else race conditions