History

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.

Paul E. McKenney committed 5 years ago

Commit 59e83661 parent 25f6fa51 file · +6 −1Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/rcu/rcutorture.c+6−1
@@ -2022,8 +2022,13 @@ static int rcu_torture_stall(void *args) · 2021 unmodified lines
20222022 __func__, raw_smp_processor_id());
20232023 while (ULONG_CMP_LT((unsigned long)ktime_get_seconds(),
20242024 stop_at))
2025− if (stall_cpu_block)
2025+ if (stall_cpu_block) {
2026+#ifdef CONFIG_PREEMPTION
2027+ preempt_schedule();
2028+#else
20262029 schedule_timeout_uninterruptible(HZ);
2030+#endif
2031+ }
20272032 if (stall_cpu_irqsoff)
20282033 local_irq_enable();
20292034 else if (!stall_cpu_block)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t