summaryrefslogtreecommitdiff
path: root/kernel/cpu.c
diff options
context:
space:
mode:
authorMohammed Khajapasha <mkhaja@codeaurora.org>2017-07-07 13:06:00 +0530
committerMohammed Khajapasha <mkhaja@codeaurora.org>2017-07-07 15:20:34 +0530
commit131e4378a0d7ae16ca61c0364ff35d987e782254 (patch)
treede555b0a479dc6b643776491c181d25247b9b267 /kernel/cpu.c
parent0c44f3c838e32d6c4928a3d175b5406b4b4af293 (diff)
Revert "sched: Remove synchronize rcu/sched calls from _cpu_down"
This reverts commit 36131fdc87c8 ("sched: Remove synchronize rcu/sched calls from _cpu_down"). Removing the synchronization of rcu/sched calls from _cpu_down introduces a race where tasks may get queued on an inactive CPU and unthrottling cfs_rqs. Change-Id: Ie29f8d185eb55979f9ca4e6e1b767caba6dd7f27 Signed-off-by: Mohammed Khajapasha <mkhaja@codeaurora.org>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 1a26ef5b7d58..87b88e8c0233 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -375,6 +375,21 @@ static int _cpu_down(unsigned int cpu, int tasks_frozen)
goto out_release;
}
+ /*
+ * 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 wait for both.
+ *
+ * Do sync before park smpboot threads to take care the rcu boost case.
+ */
+ if (IS_ENABLED(CONFIG_PREEMPT))
+ synchronize_rcu_mult(call_rcu, call_rcu_sched);
+ else
+ synchronize_rcu();
+
smpboot_park_threads(cpu);
/*