Re: [PATCH] sched/idle: Make forced polling state race-safe

From: Peter Zijlstra

Date: Fri Oct 16 2026 - 05:02:59 EST


On Thu, Oct 15, 2026 at 06:42:11PM +0900, Hui Su wrote:
> cpu_idle_poll_ctrl() maintains a global nesting count for forced idle
> polling. The count is updated with plain increments and decrements while
> idle CPUs read it without synchronization.
>
> Use an atomic counter to make the nesting count safe against concurrent
> updates and to make idle-side accesses race-free.
>
> The weak arch_cpu_idle() fallback also permanently switches the generic
> idle path to polling. Keep that state separate from the temporary
> request counter so a concurrent request cannot overwrite, or later
> release, the fallback state.
>

This is about cpu_idle_poll_ctr(), right? Is there any actual
concurrency on that thing? Afaict there is just init time twiddling
there.