Re: [PATCH 1/2] sched/fair: Couple wakee flips with heavy wakers

From: Tao Zhou
Date: Wed Nov 10 2021 - 04:52:57 EST


On Fri, Oct 29, 2021 at 09:42:19AM +0100, Mel Gorman wrote:
> On Fri, Oct 29, 2021 at 12:19:48AM +0800, Tao Zhou wrote:
> > Hi Mel,
> >
> > On Thu, Oct 28, 2021 at 10:48:33AM +0100, Mel Gorman wrote:
> >
> > > @@ -5865,6 +5865,14 @@ static void record_wakee(struct task_struct *p)
> > > }
> > >
> > > if (current->last_wakee != p) {
> > > + int min = __this_cpu_read(sd_llc_size) << 1;
> > > + /*
> > > + * Couple the wakee flips to the waker for the case where it
> > > + * doesn't accrue flips, taking care to not push the wakee
> > > + * high enough that the wake_wide() heuristic fails.
> > > + */
> > > + if (current->wakee_flips > p->wakee_flips * min)
> > > + p->wakee_flips++;
> > > current->last_wakee = p;
> > > current->wakee_flips++;
> > > }
> > > @@ -5895,7 +5903,7 @@ static int wake_wide(struct task_struct *p)
> > >
> > > if (master < slave)
> > > swap(master, slave);
> > > - if (slave < factor || master < slave * factor)
> > > + if ((slave < factor && master < (factor>>1)*factor) || master < slave * factor)
> >
> > So, the check like this include the above range:
> >
> > if ((slave < factor && master < slave * factor) ||
> > master < slave * factor)
> >
> > That "factor>>1" filter some.
> >
> > If "slave < factor" is true and "master < (factor>>1)*factor" is false,
> > then we check "master < slave * factor".(This is one path added by the
> > check "&& master < (factor>>1)*factor").
> > In the latter check "slave < factor" must be true, the result of this
> > check depend on slave in the range [factor, factor>>1] if there is possibility
> > that "master < slave * factor". If slave in [factor>>1, 0], the check of
> > "master < slave * factor" is absolutly false and this can be filtered if
> > we use a variable to load the result of master < (factor>>1)*factor.
> >
> > My random random inputs and continue confusing to move on.
> >
>
> I'm not sure what point you're trying to make.

Ok, some days later even can not understand what my saying myself. After
wrong and right aross with my wreck head I just try to make this:

if ((slave < factor && master < (factor>>1)*factor) || (slave >= factor>>1) && master < slave * factor)

check "slave > factor>>1" for filter the cases that is calculated if I
am not wrong. If this have a little effect that will be to not need to
do "master < slave * factor" for some time not sure.