mips: Use generic idle thread allocation
authorThomas Gleixner <tglx@linutronix.de>
Fri, 20 Apr 2012 13:05:51 +0000 (13:05 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 26 Apr 2012 10:06:11 +0000 (12:06 +0200)
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Link: http://lkml.kernel.org/r/20120420124557.512158271@linutronix.de
arch/mips/Kconfig
arch/mips/kernel/smp.c

index ce30e2f91d7748c0c36eb8847390bd101192a044..186fc8cf9ee0b37c4ef7def5d423cb67e8f6db77 100644 (file)
@@ -29,6 +29,7 @@ config MIPS
        select HAVE_MEMBLOCK
        select HAVE_MEMBLOCK_NODE_MAP
        select ARCH_DISCARD_MEMBLOCK
+       select GENERIC_SMP_IDLE_THREAD
 
 menu "Machine selection"
 
index 41079b256092c89335d4e171f7b73ac1fe8db51e..71a95f55a6493be90e4695de4d4c948a0dfa465f 100644 (file)
@@ -186,61 +186,9 @@ void __devinit smp_prepare_boot_cpu(void)
        cpu_set(0, cpu_callin_map);
 }
 
-/*
- * Called once for each "cpu_possible(cpu)".  Needs to spin up the cpu
- * and keep control until "cpu_online(cpu)" is set.  Note: cpu is
- * physical, not logical.
- */
-static struct task_struct *cpu_idle_thread[NR_CPUS];
-
-struct create_idle {
-       struct work_struct work;
-       struct task_struct *idle;
-       struct completion done;
-       int cpu;
-};
-
-static void __cpuinit do_fork_idle(struct work_struct *work)
-{
-       struct create_idle *c_idle =
-               container_of(work, struct create_idle, work);
-
-       c_idle->idle = fork_idle(c_idle->cpu);
-       complete(&c_idle->done);
-}
-
 int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
 {
-       struct task_struct *idle;
-
-       /*
-        * Processor goes to start_secondary(), sets online flag
-        * The following code is purely to make sure
-        * Linux can schedule processes on this slave.
-        */
-       if (!cpu_idle_thread[cpu]) {
-               /*
-                * Schedule work item to avoid forking user task
-                * Ported from arch/x86/kernel/smpboot.c
-                */
-               struct create_idle c_idle = {
-                       .cpu    = cpu,
-                       .done   = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
-               };
-
-               INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle);
-               schedule_work(&c_idle.work);
-               wait_for_completion(&c_idle.done);
-               idle = cpu_idle_thread[cpu] = c_idle.idle;
-
-               if (IS_ERR(idle))
-                       panic(KERN_ERR "Fork failed for CPU %d", cpu);
-       } else {
-               idle = cpu_idle_thread[cpu];
-               init_idle(idle, cpu);
-       }
-
-       mp_ops->boot_secondary(cpu, idle);
+       mp_ops->boot_secondary(cpu, tidle);
 
        /*
         * Trust is futile.  We should really have timeouts ...