Re: [PATCH 1/2] sched/fair: Drop idle recency from slow-path CPU selection

From: Vincent Guittot

Date: Thu Sep 17 2026 - 10:59:57 EST


On Wed, 16 Sept 2026 at 12:01, Christian Loehle
<christian.loehle@xxxxxxx> wrote:
>
> The slow-path CPU picker favours the most recently idle CPU as a proxy
> for cache warmth.
>
> A more recent idle stamp may make ongoing entry more likely. Among CPUs
> with equal advertised exit latency, this may favour the one with the
> highest wakeup cost: if entry cannot be aborted, it must finish entry and
> then exit, while an already-resident CPU only needs to exit. The same
> advertised worst-case latency covers both cases.
>
> idle_stamp does not track the current CPUIdle entry, so an older
> scheduler-idle CPU may also be re-entering.
>
> A recent scheduler-idle transition may also mark a short gap in recurring
> task activity, so the CPU may soon be busy again.
>
> Drop the timestamp tie-break, retaining the first idle candidate unless
> a lower advertised exit latency is found.

Reviewed-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>

>
> Signed-off-by: Christian Loehle <christian.loehle@xxxxxxx>
> ---
> kernel/sched/fair.c | 15 +--------------
> 1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 7455a83a6a99..ff5793bddc35 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8459,7 +8459,6 @@ sched_balance_find_dst_group_cpu(struct sched_group *group, struct task_struct *
> {
> unsigned long load, min_load = ULONG_MAX;
> unsigned int min_exit_latency = UINT_MAX;
> - u64 latest_idle_timestamp = 0;
> int least_loaded_cpu = this_cpu;
> int shallowest_idle_cpu = -1;
> int i;
> @@ -8480,23 +8479,11 @@ sched_balance_find_dst_group_cpu(struct sched_group *group, struct task_struct *
>
> if (available_idle_cpu(i)) {
> struct cpuidle_state *idle = idle_get_state(rq);
> if (idle && idle->exit_latency < min_exit_latency) {
> - /*
> - * We give priority to a CPU whose idle state
> - * has the smallest exit latency irrespective
> - * of any idle timestamp.
> - */
> min_exit_latency = idle->exit_latency;
> - latest_idle_timestamp = rq->idle_stamp;
> shallowest_idle_cpu = i;
> } else if ((!idle || idle->exit_latency == min_exit_latency) &&
> - rq->idle_stamp > latest_idle_timestamp) {
> - /*
> - * If equal or no active idle state, then
> - * the most recently idled CPU might have
> - * a warmer cache.
> - */
> - latest_idle_timestamp = rq->idle_stamp;
> + shallowest_idle_cpu == -1) {
> shallowest_idle_cpu = i;
> }
> } else if (shallowest_idle_cpu == -1) {
> --
> 2.34.1