aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2009-09-08 18:54:35 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-17 18:05:34 -0400
commitb8d57a76d9f92aa63b4f12990da5697b17000b0c (patch)
treea3be4dafddde67043deaf9a9dbf2a26bc7b7c80a
parentb835db1f9cadaf008750a32664e35a207782c95e (diff)
rcutorture: Occasionally delay readers enough to make RCU force_quiescent_state
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> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: laijs@cn.fujitsu.com Cc: dipankar@in.ibm.com Cc: akpm@linux-foundation.org Cc: mathieu.desnoyers@polymtl.ca Cc: josht@linux.vnet.ibm.com Cc: dvhltc@us.ibm.com Cc: niv@us.ibm.com Cc: peterz@infradead.org LKML-Reference: <12524504772607-git-send-email-> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--kernel/rcutorture.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index b33db539a8ad..328a8257c885 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -281,14 +281,17 @@ static int rcu_torture_read_lock(void) __acquires(RCU)
281 281
282static void rcu_read_delay(struct rcu_random_state *rrsp) 282static void rcu_read_delay(struct rcu_random_state *rrsp)
283{ 283{
284 long delay; 284 const unsigned long shortdelay_us = 200;
285 const long longdelay = 200; 285 const unsigned long longdelay_ms = 50;
286 286
287 /* We want there to be long-running readers, but not all the time. */ 287 /* We want a short delay sometimes to make a reader delay the grace
288 * period, and we want a long delay occasionally to trigger
289 * force_quiescent_state. */
288 290
289 delay = rcu_random(rrsp) % (nrealreaders * 2 * longdelay); 291 if (!(rcu_random(rrsp) % (nrealreaders * 2000 * longdelay_ms)))
290 if (!delay) 292 mdelay(longdelay_ms);
291 udelay(longdelay); 293 if (!(rcu_random(rrsp) % (nrealreaders * 2 * shortdelay_us)))
294 udelay(shortdelay_us);
292} 295}
293 296
294static void rcu_torture_read_unlock(int idx) __releases(RCU) 297static void rcu_torture_read_unlock(int idx) __releases(RCU)