]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/cpu.c
Merge remote-tracking branch 'tip/auto-latest'
[karo-tx-linux.git] / kernel / cpu.c
index d7f07a2da5a6b6bcc682d39918b3bd97471d9543..63aa50d7ce1efa16f9c29faa97f734f8c5db5d34 100644 (file)
@@ -308,6 +308,23 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
        }
        smpboot_park_threads(cpu);
 
+       /*
+        * By now we've cleared cpu_active_mask, wait for all preempt-disabled
+        * and RCU users of this state to go away such that all new such users
+        * will observe it.
+        *
+        * For CONFIG_PREEMPT we have preemptible RCU and its sync_rcu() might
+        * not imply sync_sched(), so explicitly call both.
+        */
+#ifdef CONFIG_PREEMPT
+       synchronize_sched();
+#endif
+       synchronize_rcu();
+
+       /*
+        * So now all preempt/rcu users must observe !cpu_active().
+        */
+
        err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu));
        if (err) {
                /* CPU didn't die: tell everyone.  Can't complain. */