From: Manfred Spraul <manfred@colorfullife.com>

Based on an initial patch from Oleg Nesterov <oleg@tv-sign.ru>

rcu_data.last_qsctr is not needed.  Actually, not even a counter is needed,
just a flag that indicates that there was a quiescent state.

Signed-Off-By: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/linux/rcupdate.h |   13 +++++++------
 25-akpm/kernel/rcupdate.c        |   11 +++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff -puN include/linux/rcupdate.h~rcu-simplify-quiescent-state-detection include/linux/rcupdate.h
--- 25/include/linux/rcupdate.h~rcu-simplify-quiescent-state-detection	2004-12-31 01:25:46.921735160 -0800
+++ 25-akpm/include/linux/rcupdate.h	2004-12-31 01:25:46.926734400 -0800
@@ -87,9 +87,7 @@ static inline int rcu_batch_after(long a
 struct rcu_data {
 	/* 1) quiescent state handling : */
 	long		quiescbatch;     /* Batch # for grace period */
-	long		qsctr;		 /* User-mode/idle loop etc. */
-	long            last_qsctr;	 /* value of qsctr at beginning */
-					 /* of rcu grace period */
+	int		passed_quiesc;	 /* User-mode/idle loop etc. */
 	int		qs_pending;	 /* core waits for quiesc state */
 
 	/* 2) batch handling */
@@ -109,17 +107,20 @@ extern struct rcu_ctrlblk rcu_ctrlblk;
 extern struct rcu_ctrlblk rcu_bh_ctrlblk;
 
 /*
- * Increment the quiscent state counter.
+ * Increment the quiescent state counter.
+ * The counter is a bit degenerated: We do not need to know
+ * how many quiescent states passed, just if there was at least
+ * one since the start of the grace period. Thus just a flag.
  */
 static inline void rcu_qsctr_inc(int cpu)
 {
 	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
-	rdp->qsctr++;
+	rdp->passed_quiesc = 1;
 }
 static inline void rcu_bh_qsctr_inc(int cpu)
 {
 	struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
-	rdp->qsctr++;
+	rdp->passed_quiesc = 1;
 }
 
 static inline int __rcu_pending(struct rcu_ctrlblk *rcp,
diff -puN kernel/rcupdate.c~rcu-simplify-quiescent-state-detection kernel/rcupdate.c
--- 25/kernel/rcupdate.c~rcu-simplify-quiescent-state-detection	2004-12-31 01:25:46.922735008 -0800
+++ 25-akpm/kernel/rcupdate.c	2004-12-31 01:25:46.927734248 -0800
@@ -219,9 +219,9 @@ static void rcu_check_quiescent_state(st
 			struct rcu_state *rsp, struct rcu_data *rdp)
 {
 	if (rdp->quiescbatch != rcp->cur) {
-		/* new grace period: record qsctr value. */
+		/* start new grace period: */
 		rdp->qs_pending = 1;
-		rdp->last_qsctr = rdp->qsctr;
+		rdp->passed_quiesc = 0;
 		rdp->quiescbatch = rcp->cur;
 		return;
 	}
@@ -234,11 +234,10 @@ static void rcu_check_quiescent_state(st
 		return;
 
 	/* 
-	 * Races with local timer interrupt - in the worst case
-	 * we may miss one quiescent state of that CPU. That is
-	 * tolerable. So no need to disable interrupts.
+	 * Was there a quiescent state since the beginning of the grace
+	 * period? If no, then exit and wait for the next call.
 	 */
-	if (rdp->qsctr == rdp->last_qsctr)
+	if (!rdp->passed_quiesc)
 		return;
 	rdp->qs_pending = 0;
 
_