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.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -2022,8 +2022,13 @@ static int rcu_torture_stall(void *args) · 2021 unmodified lines | ||
| 2022 | 2022 | __func__, raw_smp_processor_id()); |
| 2023 | 2023 | while (ULONG_CMP_LT((unsigned long)ktime_get_seconds(), |
| 2024 | 2024 | stop_at)) |
| 2025 | − if (stall_cpu_block) | |
| 2025 | + if (stall_cpu_block) { | |
| 2026 | +#ifdef CONFIG_PREEMPTION | |
| 2027 | + preempt_schedule(); | |
| 2028 | +#else | |
| 2026 | 2029 | schedule_timeout_uninterruptible(HZ); |
| 2030 | +#endif | |
| 2031 | + } | |
| 2027 | 2032 | if (stall_cpu_irqsoff) |
| 2028 | 2033 | local_irq_enable(); |
| 2029 | 2034 | else if (!stall_cpu_block) |