mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2 2.6.10] rcu: simplify quiescent state detection
@ 2004-12-29 15:25 Manfred Spraul
  2004-12-30 16:15 ` Oleg Nesterov
  0 siblings, 1 reply; 2+ messages in thread
From: Manfred Spraul @ 2004-12-29 15:25 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, oleg


Based on an initial patch from Oleg Nesterov:

> Is the rcu_data.last_qsctr really needed?
>
> It is used in rcu_check_quiescent_state() exclusively.
> I think we can reset qsctr at the start of the grace period,
> and then just test qsctr against 0.
>
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

No, it's not needed. Actually: not even a counter is needed, just
a flag that indicates that there was a quiescent state.

Updated, rediffed against 2.6.10 and tested.

Signed-Off-By: Manfred Spraul <manfred@colorfullife.com>

// Kernel Version:
//  VERSION = 2
//  PATCHLEVEL = 6
//  SUBLEVEL = 10
//  EXTRAVERSION =
--- 2.6/include/linux/rcupdate.h	2004-12-29 15:35:54.000000000 +0100
+++ build-2.6/include/linux/rcupdate.h	2004-12-29 15:58:30.335784619 +0100
@@ -88,9 +88,7 @@
 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 */
@@ -110,17 +108,20 @@
 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,
--- 2.6/kernel/rcupdate.c	2004-12-29 15:35:54.000000000 +0100
+++ build-2.6/kernel/rcupdate.c	2004-12-29 16:00:43.938620070 +0100
@@ -216,9 +216,9 @@
 			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;
 	}
@@ -231,11 +231,10 @@
 		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;



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2 2.6.10] rcu: simplify quiescent state detection
  2004-12-29 15:25 [PATCH 1/2 2.6.10] rcu: simplify quiescent state detection Manfred Spraul
@ 2004-12-30 16:15 ` Oleg Nesterov
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2004-12-30 16:15 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: akpm, linux-kernel

Manfred Spraul wrote:
> 
> No, it's not needed. Actually: not even a counter is needed, just
> a flag that indicates that there was a quiescent state.
> 

Yes, this patch is obviously better.

Oleg.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-30 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-29 15:25 [PATCH 1/2 2.6.10] rcu: simplify quiescent state detection Manfred Spraul
2004-12-30 16:15 ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome