All of lore.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,
	josht@linux.vnet.ibm.com, dvhltc@us.ibm.com, niv@us.ibm.com,
	tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org,
	Josh Triplett <josh@joshtriplett.org>
Subject: [PATCH tip/core/rcu 1/3] rcutorture: Occasionally delay readers enough to make RCU force_quiescent_state
Date: Tue,  8 Sep 2009 15:54:35 -0700	[thread overview]
Message-ID: <12524504772607-git-send-email-> (raw)
In-Reply-To: <20090908225349.GA19524@linux.vnet.ibm.com>

From: Josh Triplett <josh@joshtriplett.org>

rcutorture already delays readers, but never for long enough to make RCU
force a quiescent state.  Add an occasional delay of 50ms.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---
 kernel/rcutorture.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index b33db53..328a825 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -281,14 +281,17 @@ static int rcu_torture_read_lock(void) __acquires(RCU)
 
 static void rcu_read_delay(struct rcu_random_state *rrsp)
 {
-	long delay;
-	const long longdelay = 200;
+	const unsigned long shortdelay_us = 200;
+	const unsigned long longdelay_ms = 50;
 
-	/* We want there to be long-running readers, but not all the time. */
+	/* We want a short delay sometimes to make a reader delay the grace
+	 * period, and we want a long delay occasionally to trigger
+	 * force_quiescent_state. */
 
-	delay = rcu_random(rrsp) % (nrealreaders * 2 * longdelay);
-	if (!delay)
-		udelay(longdelay);
+	if (!(rcu_random(rrsp) % (nrealreaders * 2000 * longdelay_ms)))
+		mdelay(longdelay_ms);
+	if (!(rcu_random(rrsp) % (nrealreaders * 2 * shortdelay_us)))
+		udelay(shortdelay_us);
 }
 
 static void rcu_torture_read_unlock(int idx) __releases(RCU)
-- 
1.5.2.5


  reply	other threads:[~2009-09-08 22:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-08 22:53 [PATCH tip/core/rcu 0/3] increase rcutorture intensity and fix a couple resulting bugs Paul E. McKenney
2009-09-08 22:54 ` Paul E. McKenney [this message]
2009-09-12  7:45   ` [PATCH tip/core/rcu 1/3] rcutorture: Occasionally delay readers enough to make RCU force_quiescent_state Ingo Molnar
2009-09-12 14:36     ` Paul E. McKenney
2009-09-12  7:55   ` [tip:core/urgent] " tip-bot for Josh Triplett
2009-09-17 22:10   ` tip-bot for Josh Triplett
2009-09-08 22:54 ` [PATCH tip/core/rcu 2/3] Need to update rnp->gpnum if preemptable RCU is to be reliable Paul E. McKenney
2009-09-12  7:55   ` [tip:core/urgent] rcu: " tip-bot for Paul E. McKenney
2009-09-17 22:10   ` tip-bot for Paul E. McKenney
2009-09-08 22:54 ` [PATCH tip/core/rcu 3/3] Initialize multi-level RCU grace periods holding locks Paul E. McKenney
2009-09-12  7:55   ` [tip:core/urgent] rcu: " tip-bot for Paul E. McKenney
2009-09-17 22:10   ` tip-bot for Paul E. McKenney
2009-09-08 23:37 ` [PATCH tip/core/rcu 0/3] increase rcutorture intensity and fix a couple resulting bugs Steven Rostedt
2009-09-09 17:43 ` Valdis.Kletnieks
2009-09-09 18:23   ` Paul E. McKenney
2009-09-12  7:46   ` Ingo Molnar

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=12524504772607-git-send-email- \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dipankar@in.ibm.com \
    --cc=dvhltc@us.ibm.com \
    --cc=josh@joshtriplett.org \
    --cc=josht@linux.vnet.ibm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.