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
2022 __func__, raw_smp_processor_id());2022 __func__, raw_smp_processor_id());
2023 while (ULONG_CMP_LT((unsigned long)ktime_get_seconds(),2023 while (ULONG_CMP_LT((unsigned long)ktime_get_seconds(),
2024 stop_at))2024 stop_at))
2025 if (stall_cpu_block)2025 if (stall_cpu_block) {
2026#ifdef CONFIG_PREEMPTION
2027 preempt_schedule();
2028#else
2026 schedule_timeout_uninterruptible(HZ);2029 schedule_timeout_uninterruptible(HZ);
2030#endif
2031 }
2027 if (stall_cpu_irqsoff)2032 if (stall_cpu_irqsoff)
2028 local_irq_enable();2033 local_irq_enable();
2029 else if (!stall_cpu_block)2034 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