Skip to content

Commit e546f48

Browse files
Lai Jiangshanpaulmck
authored andcommitted
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>
1 parent 84483ea commit e546f48

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎kernel/rcutorture.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ static void rcu_read_delay(struct rcu_random_state *rrsp)
303303
mdelay(longdelay_ms);
304304
if (!(rcu_random(rrsp) % (nrealreaders * 2 * shortdelay_us)))
305305
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
306310
}
307311

308312
static void rcu_torture_read_unlock(int idx) __releases(RCU)
@@ -536,6 +540,8 @@ static void srcu_read_delay(struct rcu_random_state *rrsp)
536540
delay = rcu_random(rrsp) % (nrealreaders * 2 * longdelay * uspertick);
537541
if (!delay)
538542
schedule_timeout_interruptible(longdelay);
543+
else
544+
rcu_read_delay(rrsp);
539545
}
540546

541547
static void srcu_torture_read_unlock(int idx) __releases(&srcu_ctl)

0 commit comments

Comments
 (0)