public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca,
	josh@joshtriplett.org, dvhltc@us.ibm.com, niv@us.ibm.com,
	tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org,
	Valdis.Kletnieks@vt.edu, dhowells@redhat.com,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH tip/core/rcu 09/11] rcu: remove redundant grace-period check
Date: Mon,  4 Jan 2010 15:09:08 -0800	[thread overview]
Message-ID: <1262646550562-git-send-email-> (raw)
In-Reply-To: <20100104230850.GA22111@linux.vnet.ibm.com>

From: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

The rcu_process_dyntick() function checks twice for the end of
the current grace period.  However, it holds the current rcu_node
structure's ->lock field throughout, and doesn't get to the second call
to rcu_gp_in_progress() unless there is at least one CPU corresponding
to this rcu_node structure that has not yet checked in for the current
grace period, which would prevent the current grace period from ending.
So the current grace period cannot have ended, and the second check is
redundant, so remove it.

Also, given that this function is used even with !CONFIG_NO_HZ, its name
is quite misleading.  Change from rcu_process_dyntick() to force_qs_rnp().

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

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 6268f37..d920285 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1146,8 +1146,7 @@ void rcu_check_callbacks(int cpu, int user)
  * have not yet encountered a quiescent state, using the function specified.
  * The caller must have suppressed start of new grace periods.
  */
-static void rcu_process_dyntick(struct rcu_state *rsp,
-				int (*f)(struct rcu_data *))
+static void force_qs_rnp(struct rcu_state *rsp, int (*f)(struct rcu_data *))
 {
 	unsigned long bit;
 	int cpu;
@@ -1172,7 +1171,7 @@ static void rcu_process_dyntick(struct rcu_state *rsp,
 			if ((rnp->qsmask & bit) != 0 && f(rsp->rda[cpu]))
 				mask |= bit;
 		}
-		if (mask != 0 && rcu_gp_in_progress(rsp)) {
+		if (mask != 0) {
 
 			/* rcu_report_qs_rnp() releases rnp->lock. */
 			rcu_report_qs_rnp(mask, rsp, rnp, flags);
@@ -1222,7 +1221,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
 			break; /* So gcc recognizes the dead code. */
 
 		/* Record dyntick-idle state. */
-		rcu_process_dyntick(rsp, dyntick_save_progress_counter);
+		force_qs_rnp(rsp, dyntick_save_progress_counter);
 		spin_lock(&rnp->lock);  /* irqs already disabled */
 		if (rcu_gp_in_progress(rsp))
 			rsp->signaled = RCU_FORCE_QS;
@@ -1232,7 +1231,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
 
 		/* Check dyntick-idle state, send IPI to laggarts. */
 		spin_unlock(&rnp->lock);  /* irqs remain disabled */
-		rcu_process_dyntick(rsp, rcu_implicit_dynticks_qs);
+		force_qs_rnp(rsp, rcu_implicit_dynticks_qs);
 
 		/* Leave state in case more forcing is required. */
 
-- 
1.5.2.5


  parent reply	other threads:[~2010-01-04 23:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-04 23:08 [PATCH tip/core/rcu 0/11] rcu: suppress GP start to simplify force_quiescent_state() Paul E. McKenney
2010-01-04 23:09 ` [PATCH tip/core/rcu 01/11] rcu: adjust force_quiescent_state() locking, step 1 Paul E. McKenney
2010-01-13 10:24   ` [tip:core/rcu] rcu: Adjust " tip-bot for Paul E. McKenney
2010-01-04 23:09 ` [PATCH tip/core/rcu 02/11] rcu: adjust force_quiescent_state() locking, step 2 Paul E. McKenney
2010-01-13 10:25   ` [tip:core/rcu] rcu: Adjust " tip-bot for Paul E. McKenney
2010-01-04 23:09 ` [PATCH tip/core/rcu 03/11] rcu: prohibit starting new grace periods while forcing quiescent states Paul E. McKenney
2010-01-13 10:25   ` [tip:core/rcu] rcu: Prohibit " tip-bot for Paul E. McKenney
2010-01-04 23:09 ` [PATCH tip/core/rcu 04/11] rcu: eliminate local variable signaled from force_quiescent_state() Paul E. McKenney
2010-01-13 10:25   ` [tip:core/rcu] rcu: Eliminate " tip-bot for Paul E. McKenney
2010-01-04 23:09 ` [PATCH tip/core/rcu 05/11] rcu: eliminate local variable lastcomp " Paul E. McKenney
2010-01-13 10:25   ` [tip:core/rcu] rcu: Eliminate " tip-bot for Paul E. McKenney
2010-01-04 23:09 ` [PATCH tip/core/rcu 06/11] rcu: eliminate second argument of rcu_process_dyntick() Paul E. McKenney
2010-01-13 10:26   ` [tip:core/rcu] rcu: Eliminate " tip-bot for Paul E. McKenney
2010-01-04 23:09 ` [PATCH tip/core/rcu 07/11] rcu: eliminate rcu_process_dyntick() return value Paul E. McKenney
2010-01-13 10:26   ` [tip:core/rcu] rcu: Eliminate " tip-bot for Paul E. McKenney
2010-01-04 23:09 ` [PATCH tip/core/rcu 08/11] rcu: remove leg of force_quiescent_state() switch statement Paul E. McKenney
2010-01-13 10:26   ` [tip:core/rcu] rcu: Remove " tip-bot for Paul E. McKenney
2010-01-04 23:09 ` Paul E. McKenney [this message]
2010-01-13 10:26   ` [tip:core/rcu] rcu: Remove redundant grace-period check tip-bot for Paul E. McKenney
2010-01-04 23:09 ` [PATCH tip/core/rcu 10/11] rcu: make force_quiescent_state() start grace period if needed Paul E. McKenney
2010-01-13 10:27   ` [tip:core/rcu] rcu: Make " tip-bot for Paul E. McKenney
2010-01-04 23:09 ` [PATCH tip/core/rcu 11/11] rcu: add force_quiescent_state() testing to rcutorture Paul E. McKenney
2010-01-13 10:27   ` [tip:core/rcu] rcu: Add " tip-bot for 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=1262646550562-git-send-email- \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhltc@us.ibm.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=niv@us.ibm.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