]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/cpu.c
Hotplug CPU: don't check cpu_online after take_cpu_down
[linux-2.6-omap-h63xx.git] / kernel / cpu.c
index 2cc409ce0a8f93012ff93432f4effe6884b0b01c..53cf508f975a69bbcbdaad611a82a5415af4b113 100644 (file)
@@ -216,7 +216,6 @@ static int __ref take_cpu_down(void *_param)
 static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 {
        int err, nr_calls = 0;
-       struct task_struct *p;
        cpumask_t old_allowed, tmp;
        void *hcpu = (void *)(long)cpu;
        unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;
@@ -250,20 +249,16 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
        cpu_clear(cpu, tmp);
        set_cpus_allowed_ptr(current, &tmp);
 
-       p = __stop_machine_run(take_cpu_down, &tcd_param, cpu);
-
-       if (IS_ERR(p) || cpu_online(cpu)) {
+       err = __stop_machine_run(take_cpu_down, &tcd_param, cpu);
+       if (err) {
                /* CPU didn't die: tell everyone.  Can't complain. */
                if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
                                            hcpu) == NOTIFY_BAD)
                        BUG();
 
-               if (IS_ERR(p)) {
-                       err = PTR_ERR(p);
-                       goto out_allowed;
-               }
-               goto out_thread;
+               goto out_allowed;
        }
+       BUG_ON(cpu_online(cpu));
 
        /* Wait for it to sleep (leaving idle task). */
        while (!idle_cpu(cpu))
@@ -279,12 +274,15 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 
        check_for_tasks(cpu);
 
-out_thread:
-       err = kthread_stop(p);
 out_allowed:
        set_cpus_allowed_ptr(current, &old_allowed);
 out_release:
        cpu_hotplug_done();
+       if (!err) {
+               if (raw_notifier_call_chain(&cpu_chain, CPU_POST_DEAD | mod,
+                                           hcpu) == NOTIFY_BAD)
+                       BUG();
+       }
        return err;
 }