]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/cpu.c
smpboot: Provide infrastructure for percpu hotplug threads
[karo-tx-linux.git] / kernel / cpu.c
index 14d32588cccdb3c6d2d64dcd451b5f2efa8e9a19..e615dfbcf794064c4220b4972da0207eefccdcdf 100644 (file)
@@ -280,12 +280,13 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
                                __func__, cpu);
                goto out_release;
        }
+       smpboot_park_threads(cpu);
 
        err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu));
        if (err) {
                /* CPU didn't die: tell everyone.  Can't complain. */
+               smpboot_unpark_threads(cpu);
                cpu_notify_nofail(CPU_DOWN_FAILED | mod, hcpu);
-
                goto out_release;
        }
        BUG_ON(cpu_online(cpu));
@@ -354,6 +355,10 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
                goto out;
        }
 
+       ret = smpboot_create_threads(cpu);
+       if (ret)
+               goto out;
+
        ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls);
        if (ret) {
                nr_calls--;
@@ -368,6 +373,9 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
                goto out_notify;
        BUG_ON(!cpu_online(cpu));
 
+       /* Wake the per cpu threads */
+       smpboot_unpark_threads(cpu);
+
        /* Now call notifier in preparation. */
        cpu_notify(CPU_ONLINE | mod, hcpu);