Re: [PATCH RESEND 2/4] sched/fair: Ignore misfit load if the destination CPU cannot help
From: Ricardo Neri
Date: Thu Apr 02 2026 - 00:24:38 EST
On Wed, Apr 01, 2026 at 10:30:53AM +0100, Christian Loehle wrote:
> On 3/30/26 23:20, Ricardo Neri wrote:
> > There is no point in identifying scheduling groups with misfit tasks if the
> > destination CPU cannot help (i.e., it has less than 20% greater capacity
> > than the most performant CPU in the group).
Thanks for looking at the patches Christian!
>
> There's a mismatch here because capacity_greater() is 5%?
> You could use 20% fits fits_capacity() I'd say it's too strict here.
My intent was to describe the difference as 5%. I made a mistake here.
I think checking for a 5% mismatch is more appropriate since should skip
misfit load if dst_cpu and the max per-CPU capacities are similar.
>
> >
> > Since migrating misfit tasks takes precedence over relieving fully_busy
> > groups, identifying a group with misfit tasks causes a destination CPU of
> > smaller maximum capacity to back off (see capacity checks in update_sd_
> > pick_busiest()) even if it can help: it could help a group of equally small
> > maximum capacity if classified as fully_busy or has_spare.
> >
> > The described situation can happen if a scheduling domain has groups of
> > big CPUs alongside two or more clusters of smaller CPUs that share L2
> > cache. Load should be balanced between these sets of smaller CPUs when
> > CONFIG_SCHED_CLUSTER is enabled.
> >
> > Signed-off-by: Ricardo Neri <ricardo.neri-calderon@xxxxxxxxxxxxxxx>
> > ---
> > kernel/sched/fair.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 9da5014f8387..3c50ecffa4c7 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -10302,7 +10302,9 @@ static inline void update_sg_lb_stats(struct lb_env *env,
> > if (local_group)
> > continue;
> >
> > - if (sd_flags & SD_ASYM_CPUCAPACITY) {
> > + /* Only look for misfit load if dst_cpu can help */
> > + if (sd_flags & SD_ASYM_CPUCAPACITY &&
> > + capacity_greater(capacity_of(env->dst_cpu), group->sgc->max_capacity)) {
> > /* Check for a misfit task on the cpu */
> > if (sgs->group_misfit_task_load < rq->misfit_task_load) {
> > sgs->group_misfit_task_load = rq->misfit_task_load;
> >
>
> Apart from the above nit:
>
> Reviewed-by: Christian Loehle <christian.loehle@xxxxxxx>
Thank you!