diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2010-06-21 04:57:42 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2010-08-19 20:18:01 -0400 |
commit | e546f485e1d7520ca0200502cdcc11b503f4805c (patch) | |
tree | 14a62f4f56eb6bb96f2621b5334dac5a3c5c4160 /kernel/rcutorture.c | |
parent | 84483ea42cd4f2781d6e97a83ab3ebd0ff19fb10 (diff) |
rcutorture: add random preemption
Add random preemption to help we to torture the preemptable rcu.
srcu_read_delay() also calls rcu_read_delay() for shorter delays.
Added comment to preempt_schedule() call indicating that no quiescent
states happen if preemption is disabled.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'kernel/rcutorture.c')
-rw-r--r-- | kernel/rcutorture.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index 2e2726d790b9..729710273dcb 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -303,6 +303,10 @@ static void rcu_read_delay(struct rcu_random_state *rrsp) | |||
303 | mdelay(longdelay_ms); | 303 | mdelay(longdelay_ms); |
304 | if (!(rcu_random(rrsp) % (nrealreaders * 2 * shortdelay_us))) | 304 | if (!(rcu_random(rrsp) % (nrealreaders * 2 * shortdelay_us))) |
305 | udelay(shortdelay_us); | 305 | udelay(shortdelay_us); |
306 | #ifdef CONFIG_PREEMPT | ||
307 | if (!preempt_count() && !(rcu_random(rrsp) % (nrealreaders * 20000))) | ||
308 | preempt_schedule(); /* No QS if preempt_disable() in effect */ | ||
309 | #endif | ||
306 | } | 310 | } |
307 | 311 | ||
308 | static void rcu_torture_read_unlock(int idx) __releases(RCU) | 312 | static void rcu_torture_read_unlock(int idx) __releases(RCU) |
@@ -536,6 +540,8 @@ static void srcu_read_delay(struct rcu_random_state *rrsp) | |||
536 | delay = rcu_random(rrsp) % (nrealreaders * 2 * longdelay * uspertick); | 540 | delay = rcu_random(rrsp) % (nrealreaders * 2 * longdelay * uspertick); |
537 | if (!delay) | 541 | if (!delay) |
538 | schedule_timeout_interruptible(longdelay); | 542 | schedule_timeout_interruptible(longdelay); |
543 | else | ||
544 | rcu_read_delay(rrsp); | ||
539 | } | 545 | } |
540 | 546 | ||
541 | static void srcu_torture_read_unlock(int idx) __releases(&srcu_ctl) | 547 | static void srcu_torture_read_unlock(int idx) __releases(&srcu_ctl) |