Re: [PATCH 1/6] sched: migration changes for core scheduling

From: Peter Zijlstra
Date: Mon Mar 22 2021 - 05:00:04 EST


On Mon, Mar 22, 2021 at 04:12:17PM +0800, Li, Aubrey wrote:

> > But suppose there is an imbalance; then this cookie crud can forever
> > stall balance.
> >
> > Imagine this cpu running a while(1); with a uniqie cookie on, then it
> > will _never_ accept other tasks == BAD.
> >
>
> How about putting the following check in sched_core_cookie_match()?
>
> + /*
> + * Ignore cookie match if there is a big imbalance between the src rq
> + * and dst rq.
> + */
> + if ((src_rq->cfs.h_nr_running - rq->cfs.h_nr_running) > 1)
> + return true;

That's just tinkering... cookie matching should not also look at
imbalance of any kind.

> Do you have any suggestions before we drop it?

Yeah, how about you make it part of task_hot() ? Have task_hot() refuse
migration it the cookie doesn't match.

task_hot() is a hint and will get ignored when appropriate.