diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2017-01-26 13:26:00 -0800 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2017-01-26 13:26:00 -0800 |
commit | caa7c8e34293d3a9f28b2c9e0482bc58b6645421 (patch) | |
tree | fb1d9c69f789ee26973232bcde81daa59174cdbc /kernel/rcu | |
parent | 41e4b159d5161b69176dab7e57a303f10e397d33 (diff) |
rcu: Make rcu_note_context_switch() do deferred NOCB wakeups
If a CONFIG_RCU_NOCB_CPUS kernel invokes call_rcu() with interrupts
disabled, wakeups must be deferred in order to avoid self-deadlock in the
cases where the disabled interrupts are due to scheduler locks being held.
In this case, a flag is set and is checked on entry to extended quiescent
states (usermode, idle), on exit from the RCU_SOFTIRQ handler, when the
CPU in question goes offline, on a subsequent invocation of call_rcu(),
and from rcu_all_qs(). However, a given CPU could avoid all of those
states for a considerable length of time.
This commit therefore allows an invocation of rcu_note_context_switch()
to do the wakeup. It also makes the wakeup function clear the
deferred-wakeup flag.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu')
-rw-r--r-- | kernel/rcu/tree.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index ff4596dce073..c3ee2f56c897 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -493,12 +493,16 @@ static void rcu_momentary_dyntick_idle(void) */ void rcu_note_context_switch(void) { + struct rcu_state *rsp; + barrier(); /* Avoid RCU read-side critical sections leaking down. */ trace_rcu_utilization(TPS("Start context switch")); rcu_sched_qs(); rcu_preempt_note_context_switch(); if (unlikely(raw_cpu_read(rcu_sched_qs_mask))) rcu_momentary_dyntick_idle(); + for_each_rcu_flavor(rsp) + do_nocb_deferred_wakeup(this_cpu_ptr(rsp->rda)); trace_rcu_utilization(TPS("End context switch")); barrier(); /* Avoid RCU read-side critical sections leaking up. */ } |