Re: [PATCH 3/5] sched/fair: Reject misfit pulls onto busy SMT siblings on asym-capacity
From: Andrea Righi
Date: Fri Apr 24 2026 - 05:21:23 EST
Hi Prateek,
On Fri, Apr 24, 2026 at 11:07:01AM +0530, K Prateek Nayak wrote:
> 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.
Yep, we can definitely cache is_core_idle(env->dst_cpu), I'll change that.
Thanks,
-Andrea