lkml.org 
[lkml]   [2021]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] sched/fair: Couple wakee flips with heavy wakers
On Fri, Oct 29, 2021 at 05:17:38PM +0200, Vincent Guittot wrote:
> > index ff69f245b939..d00af3b97d8f 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -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++;
>
> I have a hard time understanding the rationale behind these changes
> and the one below. Could you provide more details about why to
> increase p->wakee_flips here ? Also would be good to add such
> explanation in the commit message


The changelog covers it in the first two paragraphs but would the
following be better as a comment?

/*
* Couple the wakee flips to the waker for the case where the
* wakee doesn't accrue any flips during a short interval where
* there are many wakeups without cpu load average being updated.
* Otherwise, it is possible for wake_wide to not trigger followed
* by an affine wake stacking multiple tasks on the same CPU due
* to a stale cpu_load() value checked in wake_affine_weight.
* This heuristic reduces excessive stacking of tasks while taking
* care to not push the wakee high enough that the wake_wide
* heuristic fails differently.
*/

Is that any better? I know this is a heuristic that is a bit on the
fuzzy side as it's trying to clamp the worst of a corner case. Ideally
"wake_wide" would be replaced with a more straight-forward heuristic but
I'm not aware of any alternatives being proposed (and I don't have one
of my own).

--
Mel Gorman
SUSE Labs

\
 
 \ /
  Last update: 2021-11-01 09:56    [W:0.155 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site