public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot for Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com,
	hpa@zytor.com, mingo@redhat.com, tglx@linutronix.de,
	mingo@elte.hu
Subject: [tip:core/rcu] rcu: Eliminate local variable lastcomp from force_quiescent_state()
Date: Wed, 13 Jan 2010 10:25:53 GMT	[thread overview]
Message-ID: <tip-39c0bbfc07c6e28db7346d0e11106f2d045d3035@git.kernel.org> (raw)
In-Reply-To: <12626465502985-git-send-email->

Commit-ID:  39c0bbfc07c6e28db7346d0e11106f2d045d3035
Gitweb:     http://git.kernel.org/tip/39c0bbfc07c6e28db7346d0e11106f2d045d3035
Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
AuthorDate: Mon, 4 Jan 2010 15:09:04 -0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 13 Jan 2010 09:06:03 +0100

rcu: Eliminate local variable lastcomp from force_quiescent_state()

Because rsp->fqs_active is set to 1 across
force_quiescent_state()'s switch statement, rcu_start_gp() will
refrain from starting a new grace period during this time.
Therefore, rsp->gpnum is constant, and can be propagated to all
uses of lastcomp, eliminating this local variable.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: mathieu.desnoyers@polymtl.ca
Cc: josh@joshtriplett.org
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
Cc: Valdis.Kletnieks@vt.edu
Cc: dhowells@redhat.com
LKML-Reference: <12626465502985-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/rcutree.c |   10 +++-------
 kernel/rcutree.h |    2 --
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 1d8cfb1..62b6433 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1191,7 +1191,6 @@ static int rcu_process_dyntick(struct rcu_state *rsp, long lastcomp,
 static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
 {
 	unsigned long flags;
-	long lastcomp;
 	struct rcu_node *rnp = rcu_get_root(rsp);
 	u8 forcenow;
 	u8 gpdone;
@@ -1207,7 +1206,6 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
 		goto unlock_fqs_ret; /* no emergency and done recently. */
 	rsp->n_force_qs++;
 	spin_lock(&rnp->lock);  /* irqs already disabled */
-	lastcomp = rsp->gpnum - 1;
 	rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS;
 	if(!rcu_gp_in_progress(rsp)) {
 		rsp->n_force_qs_ngp++;
@@ -1228,7 +1226,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
 			break; /* So gcc recognizes the dead code. */
 
 		/* Record dyntick-idle state. */
-		gpdone = rcu_process_dyntick(rsp, lastcomp,
+		gpdone = rcu_process_dyntick(rsp, rsp->gpnum - 1,
 					     dyntick_save_progress_counter);
 		spin_lock(&rnp->lock);  /* irqs already disabled */
 		if (gpdone)
@@ -1239,11 +1237,9 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
 
 		/* Update state, record completion counter. */
 		forcenow = 0;
-		if (lastcomp + 1 == rsp->gpnum &&
-		    lastcomp == rsp->completed) {
+		if (rsp->gpnum - 1 == rsp->completed) {
 			forcenow = rsp->signaled == RCU_SAVE_COMPLETED;
 			rsp->signaled = RCU_FORCE_QS;
-			rsp->completed_fqs = lastcomp;
 		}
 		if (!forcenow)
 			break;
@@ -1253,7 +1249,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 */
-		gpdone = rcu_process_dyntick(rsp, rsp->completed_fqs,
+		gpdone = rcu_process_dyntick(rsp, rsp->gpnum - 1,
 					     rcu_implicit_dynticks_qs);
 
 		/* Leave state in case more forcing is required. */
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index dc386a7..5348561 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -296,8 +296,6 @@ struct rcu_state {
 	long orphan_qlen;			/* Number of orphaned cbs. */
 	spinlock_t fqslock;			/* Only one task forcing */
 						/*  quiescent states. */
-	long	completed_fqs;			/* Value of completed @ snap. */
-						/*  Protected by fqslock. */
 	unsigned long jiffies_force_qs;		/* Time at which to invoke */
 						/*  force_quiescent_state(). */
 	unsigned long n_force_qs;		/* Number of calls to */

  reply	other threads:[~2010-01-13 10:26 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-bot for Paul E. McKenney [this message]
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 ` [PATCH tip/core/rcu 09/11] rcu: remove redundant grace-period check Paul E. McKenney
2010-01-13 10:26   ` [tip:core/rcu] rcu: Remove " 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=tip-39c0bbfc07c6e28db7346d0e11106f2d045d3035@git.kernel.org \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --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