Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1287987

[PATCH v2 tip/core/rcu 01/11] rcu: Short-circuit synchronize_sched_expedited() if only one CPU

From "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH v2 tip/core/rcu 01/11] rcu: Short-circuit synchronize_sched_expedited() if only one CPU
Date 2015-12-10 00:10 +0100
Message-ID <qDW1Z-6ob-37@gated-at.bofh.it> (permalink)
References <qDW1Y-6ob-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


If there is only one CPU, then invoking synchronize_sched_expedited()
is by definition a grace period.  This commit checks for this condition
and does a short-circuit return in that case.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcu/tree.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 81aa1cdc6bc9..bd2605c144cc 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3822,6 +3822,10 @@ void synchronize_sched_expedited(void)
 	struct rcu_node *rnp;
 	struct rcu_state *rsp = &rcu_sched_state;
 
+	/* If only one CPU, this is automatically a grace period. */
+	if (rcu_blocking_is_gp())
+		return;
+
 	/* Take a snapshot of the sequence number.  */
 	s = rcu_exp_gp_seq_snap(rsp);
 
-- 
2.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v2 tip/core/rcu 01/11] rcu: Short-circuit synchronize_sched_expedited() if only one CPU "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-12-10 00:10 +0100

csiph-web