Re: [RFC PATCH] sched/fair: Introduce WAKEUP_BIAS_PREV_IDLE to reduce migrations

From: Chen Yu
Date: Sun Oct 15 2023 - 12:08:31 EST


On 2023-10-12 at 16:36:26 -0400, Mathieu Desnoyers wrote:
> Introduce the WAKEUP_BIAS_PREV_IDLE scheduler feature to reduce the
> task migration rate.
>
> For scenarios where the system is under-utilized (CPUs are partly idle),
> eliminate frequent task migrations from almost idle CPU to completely
> idle CPUs by introducing a bias towards the previous CPU if it is idle
> or almost idle in select_idle_sibling(). Use 1% of the CPU capacity
> of the previously used CPU as CPU utilization "almost idle" cutoff.
>
> +
> +/*
> + * A runqueue is considered almost idle if:
> + *
> + * cpu_util_without(cpu, p) / 1024 <= 1% * capacity_of(cpu)

util_avg is in the range [0:1024], thus cpu_util_without(cpu, p) / 1024
is <= 1, and 1% * cap is 10, so 1 <= 10 is always true.
I suppose you want to compare:
(cpu_util_without(cpu, p) / capacity_orig_of(cpu)) <= 1% ->
cpu_util_without(cpu, p) * 100 <= capacity_orig_of(cpu) ?

thanks,
Chenyu