On 3/30/26 23:20, Ricardo Neri wrote:
> sched_balance_find_src_rq() is supposed to avoid picking as busiest a
> runqueue with a single running task since that would result in the task
> migrating to a lower-capacity CPU. It also prevents migrations between CPUs
> of equal capacity.
>
> Migrating tasks between CPUs of equal capacity helps when balancing load in
> a scheduling domain in which there are CPUs of different capacity and are
> grouped in clusters of CPUs of equal capacity that share L2 cache. Load
> should be balanced among these clusters when CONFIG_SCHED_CLUSTER is
> enabled.
>
> Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
> ---
> kernel/sched/fair.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 3c50ecffa4c7..a7fd4f1f4348 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -11388,6 +11388,7 @@ static struct rq *sched_balance_find_src_rq(struct lb_env *env,
> * average load.
> */
> if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
> + capacity_of(env->dst_cpu) != capacity &&
> !capacity_greater(capacity_of(env->dst_cpu), capacity) &&
> nr_running == 1)
> continue;
>
For consistency, doesn't it make sense to just invert capacity_greater() here?
So:
capacity_greater(capacity, capacity_of(env->dst_cpu))
if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
capacity_greater(capacity, capacity_of(env->dst_cpu)) &&
nr_running == 1)
continue;