[PATCH tip/core/rcu 01/23] rcu: substitute set_need_resched for sending resched IPIs

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Paul E. McKenney
Date: Tuesday, April 20, 2010 - 2:44 pm

This patch adds a check to __rcu_pending() that does a local
set_need_resched() if the current CPU is holding up the current grace
period and if force_quiescent_state() will be called soon.  The goal is
to reduce the probability that force_quiescent_state() will need to do
smp_send_reschedule(), which sends an IPI and is therefore more expensive
on most architectures.

Signed-off-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 3ec8160..e54c123 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1499,6 +1499,16 @@ static int __rcu_pending(struct rcu_state *rsp, struct rcu_data *rdp)
 
 	/* Is the RCU core waiting for a quiescent state from this CPU? */
 	if (rdp->qs_pending) {
+
+		/*
+		 * If force_quiescent_state() coming soon and this CPU
+		 * needs a quiescent state, and this is either RCU-sched
+		 * or RCU-bh, force a local reschedule.
+		 */
+		if (!rdp->preemptable &&
+		    ULONG_CMP_LT(ACCESS_ONCE(rsp->jiffies_force_qs) - 1,
+				 jiffies))
+			set_need_resched();
 		rdp->n_rp_qs_pending++;
 		return 1;
 	}
-- 
1.7.0

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH tip/core/rcu 0/23] v3 patches queued for 2.6.35, Paul E. McKenney, (Tue Apr 20, 2:44 pm)
[PATCH tip/core/rcu 01/23] rcu: substitute set_need_resche ..., Paul E. McKenney, (Tue Apr 20, 2:44 pm)
[PATCH tip/core/rcu 02/23] rcu: make dead code really dead, Paul E. McKenney, (Tue Apr 20, 2:44 pm)
[PATCH tip/core/rcu 03/23] rcu: move some code from macro ..., Paul E. McKenney, (Tue Apr 20, 2:44 pm)
[PATCH tip/core/rcu 17/23] rcu: improve the RCU CPU-stall ..., Paul E. McKenney, (Tue Apr 20, 2:44 pm)
[PATCH tip/core/rcu 18/23] Debugobjects transition check, Paul E. McKenney, (Tue Apr 20, 2:44 pm)
[PATCH tip/core/rcu 21/23] rcu head remove init, Paul E. McKenney, (Tue Apr 20, 2:44 pm)
[PATCH tip/core/rcu 23/23] rcu: make SRCU usable in modules, Paul E. McKenney, (Tue Apr 20, 2:44 pm)