X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=kernel%2Fstop_machine.c;h=e31b1cb8e5030286aa91b6b921a8abe5a32d64c5;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=9610403ce2cf2252c886029bbeebd89e66b7d289;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 9610403ce..e31b1cb8e 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -52,7 +52,12 @@ static int stopmachine(void *cpu) mb(); /* Must read state first. */ atomic_inc(&stopmachine_thread_ack); } - cpu_relax(); + /* Yield in first stage: migration threads need to + * help our sisters onto their CPUs. */ + if (!prepared && !irqs_disabled) + yield(); + else + cpu_relax(); } /* Ack: we are exiting. */ @@ -90,7 +95,7 @@ static int stop_machine(void) stopmachine_state = STOPMACHINE_WAIT; for_each_online_cpu(i) { - if (i == smp_processor_id()) + if (i == _smp_processor_id()) continue; ret = kernel_thread(stopmachine, (void *)(long)i,CLONE_KERNEL); if (ret < 0) @@ -172,7 +177,7 @@ struct task_struct *__stop_machine_run(int (*fn)(void *), void *data, /* If they don't care which CPU fn runs on, bind to any online one. */ if (cpu == NR_CPUS) - cpu = smp_processor_id(); + cpu = _smp_processor_id(); p = kthread_create(do_stop, &smdata, "kstopmachine"); if (!IS_ERR(p)) {