patch-1.3.51 linux/init/main.c

Next file: linux/kernel/ksyms.c
Previous file: linux/include/net/sock.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.50/linux/init/main.c linux/init/main.c
@@ -488,9 +488,29 @@
 	envp_init[envs+1] = NULL;
 }
 
+
 extern void setup_arch(char **, unsigned long *, unsigned long *);
 
-#ifdef __SMP__
+#ifndef __SMP__
+
+/*
+ *	Uniprocessor idle thread
+ */
+ 
+int cpu_idle(void *unused)
+{
+	for(;;)
+		idle();
+}
+
+#else
+
+/*
+ *	Multiprocessor idle thread is in arch/...
+ */
+ 
+extern int cpu_idle(void * unused);
+
 /*
  *	Activate a secondary processor.
  */
@@ -500,15 +520,10 @@
 	trap_init();
 	init_IRQ();
 	smp_callin();
-	for(;;)
-		idle();
+	cpu_idle(NULL);
 }
 
-int smp_idle(void * unused)
-{
-	for (;;)
-		idle();
-}
+
 
 /*
  *	Called by CPU#0 to activate the rest.
@@ -525,7 +540,7 @@
 
 	for(i=1;i<smp_num_cpus;i++)
 	{
-		kernel_thread(smp_idle, NULL, CLONE_PID);
+		kernel_thread(cpu_idle, NULL, CLONE_PID);
 		/*
 		 *	Assume linear processor numbering
 		 */
@@ -633,8 +648,7 @@
  *
  * Right now task[0] just does a infinite idle loop.
  */
-	for(;;)
-		idle();
+ 	cpu_idle(NULL);
 }
 
 static int printf(const char *fmt, ...)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this