Re: [PATCH] sched: Replace nr_iowait_cpu() with a bool accessor
From: Peter Zijlstra
Date: Thu Oct 15 2026 - 03:39:14 EST
On Wed, Oct 14, 2026 at 02:47:45PM +0100, Christian Loehle wrote:
> The menu governor was the last consumer of the per-CPU I/O-wait count
> that needed its magnitude, apart from nr_iowait() summing it globally.
> Commit 38f83090f515 ("cpuidle: menu: Remove iowait influence") removed
> that use. All remaining per-CPU consumers only test for zero/nonzero.
>
> Replace nr_iowait_cpu() with bool cpu_has_iowait() and update the generic
> and s390 idle accounting callers. Have nr_iowait() read the counters
> directly so that the global total and existing accounting are preserved.
> Replace the stale menu comment with a description of the predicate.
>
> Include the Coccinelle recipe for the code conversion, verified against
> the original files. The helper's comment is updated manually. Reproduce
> the conversion with:
>
> make coccicheck COCCI=scripts/coccinelle/api/cpu_has_iowait.cocci MODE=patch
>
> Signed-off-by: Christian Loehle <christian.loehle@xxxxxxx>
> ---
> arch/s390/kernel/idle.c | 4 +-
> include/linux/sched/stat.h | 2 +-
> kernel/sched/core.c | 13 ++---
> kernel/sched/cputime.c | 10 ++--
> scripts/coccinelle/api/cpu_has_iowait.cocci | 56 +++++++++++++++++++++
> 5 files changed, 69 insertions(+), 16 deletions(-)
> create mode 100644 scripts/coccinelle/api/cpu_has_iowait.cocci
So I like this; but I'm confused about including the cocci script. Why
is this?