Commit eac9256c authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Hotplug CPUs: Make Migration Thread Handle CPUs Going

Change the migration thread to directly use its cpu arg, rather than
smp_processor_id(): if a cpu goes up then down rapidly, it can be on
the wrong cpu just before it is stopped.

Add code to stop the migration thread on CPU_DEAD and CPU_UP_CANCELED.

Remove the (bogus) priority of the notifier.
parent e7243e1b
......@@ -2770,8 +2770,7 @@ static int migration_thread(void * data)
runqueue_t *rq;
int cpu = (long)data;
BUG_ON(smp_processor_id() != cpu);
rq = this_rq();
rq = cpu_rq(cpu);
BUG_ON(rq->migration_thread != current);
while (!kthread_should_stop()) {
......@@ -2886,17 +2885,22 @@ static int migration_call(struct notifier_block *nfb, unsigned long action,
/* Strictly unneccessary, as first user will wake it. */
wake_up_process(cpu_rq(cpu)->migration_thread);
break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_UP_CANCELED:
/* Unbind it from offline cpu so it can run. Fall thru. */
kthread_bind(cpu_rq(cpu)->migration_thread,smp_processor_id());
case CPU_DEAD:
kthread_stop(cpu_rq(cpu)->migration_thread);
cpu_rq(cpu)->migration_thread = NULL;
BUG_ON(cpu_rq(cpu)->nr_running != 0);
break;
#endif
}
return NOTIFY_OK;
}
/*
* We want this after the other threads, so they can use set_cpus_allowed
* from their CPU_OFFLINE callback
*/
static struct notifier_block __devinitdata migration_notifier = {
.notifier_call = migration_call,
.priority = -10,
};
int __init migration_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment