Re: [PATCH v14 12/15] cpuidle/poll_state: Wait for need-resched via tif_need_resched_relaxed_wait()

From: bot+bpf-ci

Date: Tue Jul 14 2026 - 04:12:24 EST


> cpuidle/poll_state: Wait for need-resched via tif_need_resched_relaxed_wait()
>
> The inner loop in poll_idle() polls over the thread_info flags,
> waiting to see if the thread has TIF_NEED_RESCHED set. The loop
> exits once the condition is met, or if the poll time limit has
> been exceeded.
>
> To minimize the number of instructions executed in each iteration,
> the time check is rate-limited. In addition, each loop iteration
> executes cpu_relax() which on certain platforms provides a hint to
> the pipeline that the loop busy-waits, allowing the processor to
> reduce power consumption.
>
> Switch over to tif_need_resched_relaxed_wait() instead, since that
> provides exactly that.
>
> However, since we want to minimize power consumption in idle, building
> of cpuidle/poll_state.c continues to depend on CONFIG_ARCH_HAS_CPU_RELAX
> as that serves as an indicator that the platform supports an optimized
> version of tif_need_resched_relaxed_wait() (via
> smp_cond_load_acquire_timeout()).

This isn't a bug, but the changelog names smp_cond_load_acquire_timeout() as
the backing primitive, while the code path looks like it uses the relaxed
variant:

include/linux/sched/idle.h:tif_need_resched_relaxed_wait() {
return tif_bitset_relaxed_wait(TIF_NEED_RESCHED, timeout_ns);
}

include/linux/sched/idle.h:tif_bitset_relaxed_wait() {
flags = smp_cond_load_relaxed_timeout(&current_thread_info()->flags,
(VAL & BIT(tif)),
local_clock_noinstr(),
timeout_ns);
...
}

Should this reference smp_cond_load_relaxed_timeout() instead?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/29315652884