diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2021-05-16 21:17:27 -0700 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2021-07-27 11:39:30 -0700 |
commit | 59e836662860a28880d45b35e1fbc5afca4847ce (patch) | |
tree | a34efca09e2547468226926b5827014969822c84 /kernel/rcu/rcutorture.c | |
parent | 25f6fa53a07422e2bb004229eefd32760c469fb0 (diff) | |
download | linux-59e836662860a28880d45b35e1fbc5afca4847ce.tar.gz linux-59e836662860a28880d45b35e1fbc5afca4847ce.tar.bz2 linux-59e836662860a28880d45b35e1fbc5afca4847ce.zip |
rcutorture: Preempt rather than block when testing task stalls
Currently, rcu_torture_stall() does a one-jiffy timed wait when
stall_cpu_block is set. This works, but emits a pointless splat in
CONFIG_PREEMPT=y kernels. This commit avoids this splat by instead
invoking preempt_schedule() in CONFIG_PREEMPT=y kernels.
This uses an admittedly ugly #ifdef, but abstracted approaches just
looked worse. A prettier approach would provide a preempt_schedule()
definition with a WARN_ON() for CONFIG_PREEMPT=n kernels, but this seems
quite silly.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/rcu/rcutorture.c')
-rw-r--r-- | kernel/rcu/rcutorture.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 40ef5417d954..ab4215266ebe 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2022,8 +2022,13 @@ static int rcu_torture_stall(void *args) __func__, raw_smp_processor_id()); while (ULONG_CMP_LT((unsigned long)ktime_get_seconds(), stop_at)) - if (stall_cpu_block) + if (stall_cpu_block) { +#ifdef CONFIG_PREEMPTION + preempt_schedule(); +#else schedule_timeout_uninterruptible(HZ); +#endif + } if (stall_cpu_irqsoff) local_irq_enable(); else if (!stall_cpu_block) |