Re: [PATCH v4] sched/psi: Skip CPUs with zero non-idle delta in per-CPU aggregation

From: Peter Zijlstra

Date: Mon May 04 2026 - 04:04:48 EST


On Wed, Apr 29, 2026 at 06:05:55PM +0800, Zhan Xusheng wrote:
> collect_percpu_times() iterates over every possible CPU to build a
> non-idle-weighted average of the PSI state times. When a CPU has
> no PSI_NONIDLE delta for the current sampling interval:
> nonidle = nsecs_to_jiffies(times[PSI_NONIDLE]) = 0
> deltas[s] += times[s] * nonidle /* += 0 */
>
> so the weighted accumulation contributes nothing.
>
> get_recent_times() already sets the PSI_NONIDLE bit in
> cpu_changed_states iff the PSI_NONIDLE delta is non-zero. Use that
> bit to skip such CPUs early, as suggested by Johannes, avoiding the
> nsecs_to_jiffies() call.
>
> No functional change intended.

So presumably this is an optimization. Where is the data that justifies
this?