diff mbox

[tip/core/rcu,36/55] rcu: Prevent early boot set_need_resched() from __rcu_pending()

Message ID 1315332049-2604-36-git-send-email-paulmck@linux.vnet.ibm.com
State Accepted
Commit 5c51dd7349d4bb26f845f17f85daa168f5fa03f2
Headers show

Commit Message

Paul E. McKenney Sept. 6, 2011, 6 p.m. UTC
From: Paul E. McKenney <paul.mckenney@linaro.org>

There isn't a whole lot of point in poking the scheduler before there
are other tasks to switch to.  This commit therefore adds a check
for rcu_scheduler_fully_active in __rcu_pending() to suppress any
pre-scheduler calls to set_need_resched().  The downside of this approach
is additional runtime overhead in a reasonably hot code path.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Josh Triplett Oct. 17, 2011, 1:49 a.m. UTC | #1
On Tue, Sep 06, 2011 at 11:00:30AM -0700, Paul E. McKenney wrote:
> From: Paul E. McKenney <paul.mckenney@linaro.org>
> 
> There isn't a whole lot of point in poking the scheduler before there
> are other tasks to switch to.  This commit therefore adds a check
> for rcu_scheduler_fully_active in __rcu_pending() to suppress any
> pre-scheduler calls to set_need_resched().  The downside of this approach
> is additional runtime overhead in a reasonably hot code path.

If you're concerned about the runtime overhead, this does seem like a
perfect candidate for jump labels.

- Josh Triplett
Paul E. McKenney Oct. 24, 2011, 12:07 p.m. UTC | #2
On Sun, Oct 16, 2011 at 06:49:15PM -0700, Josh Triplett wrote:
> On Tue, Sep 06, 2011 at 11:00:30AM -0700, Paul E. McKenney wrote:
> > From: Paul E. McKenney <paul.mckenney@linaro.org>
> > 
> > There isn't a whole lot of point in poking the scheduler before there
> > are other tasks to switch to.  This commit therefore adds a check
> > for rcu_scheduler_fully_active in __rcu_pending() to suppress any
> > pre-scheduler calls to set_need_resched().  The downside of this approach
> > is additional runtime overhead in a reasonably hot code path.
> 
> If you're concerned about the runtime overhead, this does seem like a
> perfect candidate for jump labels.

I have added this to my todo list, but would welcome a patch.

							Thanx, Paul
diff mbox

Patch

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index a07bf55..0051dbf 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1707,7 +1707,8 @@  static int __rcu_pending(struct rcu_state *rsp, struct rcu_data *rdp)
 	check_cpu_stall(rsp, rdp);
 
 	/* Is the RCU core waiting for a quiescent state from this CPU? */
-	if (rdp->qs_pending && !rdp->passed_quiesce) {
+	if (rcu_scheduler_fully_active &&
+	    rdp->qs_pending && !rdp->passed_quiesce) {
 
 		/*
 		 * If force_quiescent_state() coming soon and this CPU