Re: [PATCH 3/5] sched/fair: Reject misfit pulls onto busy SMT siblings on asym-capacity
From: K Prateek Nayak
Date: Fri Apr 24 2026 - 01:37:24 EST
Hello Andrea,
On 4/23/2026 1:06 PM, Andrea Righi wrote:
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -10815,10 +10815,16 @@ static bool update_sd_pick_busiest(struct lb_env *env,
> * We can use max_capacity here as reduction in capacity on some
> * CPUs in the group should either be possible to resolve
> * internally or be covered by avg_load imbalance (eventually).
> + *
> + * When SMT is active, only pull a misfit to dst_cpu if it is on a
> + * fully idle core; otherwise the effective capacity of the core is
> + * reduced and we may not actually provide more capacity than the
> + * source.
> */
> if ((env->sd->flags & SD_ASYM_CPUCAPACITY) &&
> (sgs->group_type == group_misfit_task) &&
> - (!capacity_greater(capacity_of(env->dst_cpu), sg->sgc->max_capacity) ||
> + ((sched_smt_active() && !is_core_idle(env->dst_cpu)) ||
update_sd_pick_busiest() goes over all the groups of the domain but the
"env->dst_cpu" remains the same throughout.
Maybe you can cache the status of is_core_idle(env->dst_cpu) in lb_env
at the beginning of update_sd_lb_stats() and save on repeating the
is_core_idle() test here?
Sure, the status can change while this CPU is load balancing but in
that case the sibling going idle will start newidle balance and it
should see the correct status and do the right thing on behalf of the
core.
> + !capacity_greater(capacity_of(env->dst_cpu), sg->sgc->max_capacity) ||
> sds->local_stat.group_type != group_has_spare))
> return false;
>
--
Thanks and Regards,
Prateek