]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - kernel/stop_machine.c
Merge branch 'x86/grand-schemozzle' of git://git.kernel.org/pub/scm/linux/kernel...
[linux.git] / kernel / stop_machine.c
index 2b5a6754646f5dc1108e2f6d029c464c5843f7c7..b4f83f7bdf86cdfa21c3d52563a9ad45d37a1164 100644 (file)
@@ -177,12 +177,18 @@ static void ack_state(struct multi_stop_data *msdata)
                set_state(msdata, msdata->state + 1);
 }
 
+void __weak stop_machine_yield(const struct cpumask *cpumask)
+{
+       cpu_relax();
+}
+
 /* This is the cpu_stop function which stops the CPU. */
 static int multi_cpu_stop(void *data)
 {
        struct multi_stop_data *msdata = data;
        enum multi_stop_state curstate = MULTI_STOP_NONE;
        int cpu = smp_processor_id(), err = 0;
+       const struct cpumask *cpumask;
        unsigned long flags;
        bool is_active;
 
@@ -192,15 +198,18 @@ static int multi_cpu_stop(void *data)
         */
        local_save_flags(flags);
 
-       if (!msdata->active_cpus)
-               is_active = cpu == cpumask_first(cpu_online_mask);
-       else
-               is_active = cpumask_test_cpu(cpu, msdata->active_cpus);
+       if (!msdata->active_cpus) {
+               cpumask = cpu_online_mask;
+               is_active = cpu == cpumask_first(cpumask);
+       } else {
+               cpumask = msdata->active_cpus;
+               is_active = cpumask_test_cpu(cpu, cpumask);
+       }
 
        /* Simple state machine */
        do {
                /* Chill out and ensure we re-read multi_stop_state. */
-               cpu_relax_yield();
+               stop_machine_yield(cpumask);
                if (msdata->state != curstate) {
                        curstate = msdata->state;
                        switch (curstate) {