From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
dvhart@linux.intel.com, fweisbec@gmail.com, oleg@redhat.com,
bobby.prani@gmail.com,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH tip/core/rcu 03/16] rcu: Make cond_resched_rcu_qs() supply RCU-sched expedited QS
Date: Tue, 12 Apr 2016 08:29:22 -0700 [thread overview]
Message-ID: <1460474975-24560-3-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160412152906.GA23395@linux.vnet.ibm.com>
Although cond_resched_rcu_qs() supplies quiescent states to all flavors
of normal RCU grace periods, it does nothing for expedited RCU-sched
grace periods. This commit therefore adds a check for a need for a
quiescent state from the current CPU by an expedited RCU-sched grace
period, and invokes rcu_sched_qs() to supply that quiescent state if so.
Note that the check is racy in that we might be migrated to some other
CPU just after checking the per-CPU variable. This is OK because the
act of migration will do a context switch, which will supply the needed
quiescent state. The only downside is that we might do an unnecessary
call to rcu_sched_qs(), but the probability is low and the overhead
is small.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcu/tree.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 687d8a5f35c7..178575c01d09 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -370,6 +370,21 @@ void rcu_all_qs(void)
rcu_momentary_dyntick_idle();
local_irq_restore(flags);
}
+ if (unlikely(raw_cpu_read(rcu_sched_data.cpu_no_qs.b.exp))) {
+ /*
+ * Yes, we just checked a per-CPU variable with preemption
+ * enabled, so we might be migrated to some other CPU at
+ * this point. That is OK because in that case, the
+ * migration will supply the needed quiescent state.
+ * We might end up needlessly disabling preemption and
+ * invoking rcu_sched_qs() on the destination CPU, but
+ * the probability and cost are both quite low, so this
+ * should not be a problem in practice.
+ */
+ preempt_disable();
+ rcu_sched_qs();
+ preempt_enable();
+ }
this_cpu_inc(rcu_qs_ctr);
barrier(); /* Avoid RCU read-side critical sections leaking up. */
}
--
2.5.2
next prev parent reply other threads:[~2016-04-12 15:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-12 15:29 [PATCH tip/core/rcu 0/16] Expedited grace-period changes for 4.7 Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 01/16] rcu: Make expedited RCU-sched grace period immediately detect idle Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 02/16] rcu: Make expedited RCU-preempt stall warnings count accurately Paul E. McKenney
2016-04-12 15:29 ` Paul E. McKenney [this message]
2016-04-12 15:29 ` [PATCH tip/core/rcu 04/16] rcu: Fix synchronize_rcu_expedited() header comment Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 05/16] rcu: Add event tracing definitions for expedited grace periods Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 06/16] rcu: Add funnel-locking tracing " Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 07/16] rcu: Add expedited-grace-period event tracing Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 08/16] rcu: Remove expedited GP funnel-lock bypass Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 09/16] rcu: Force boolean subscript for expedited stall warnings Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 10/16] rcu: Shorten expedited_workdone* to exp_workdone* Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 11/16] rcu: Enforce expedited-GP fairness via funnel wait queue Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 12/16] rcu: Add exp_funnel_lock() fastpath Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 13/16] rcu: Consolidate expedited GP code into rcu_exp_wait_wake() Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 14/16] rcu: Consolidate expedited GP tracing into rcu_exp_gp_seq_snap() Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 15/16] rcu: Consolidate expedited GP code into exp_funnel_lock() Paul E. McKenney
2016-04-12 15:29 ` [PATCH tip/core/rcu 16/16] rcu: Overlap wakeups with next expedited grace period Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460474975-24560-3-git-send-email-paulmck@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=bobby.prani@gmail.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=dvhart@linux.intel.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome