mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/4] sched/fair: Do not migrate on wake_affine_weight if weights are equal
Date: Mon, 12 Feb 2018 20:20:40 +0000	[thread overview]
Message-ID: <20180212202040.hebvzfpdzglx4miq@techsingularity.net> (raw)
In-Reply-To: <1518462889.7104.78.camel@gmx.de>

On Mon, Feb 12, 2018 at 08:14:49PM +0100, Mike Galbraith wrote:
> On Mon, 2018-02-12 at 18:29 +0100, Peter Zijlstra wrote:
> > On Mon, Feb 12, 2018 at 02:58:56PM +0000, Mel Gorman wrote:
> > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > > index c1091cb023c4..28c8d9c91955 100644
> > > --- a/kernel/sched/fair.c
> > > +++ b/kernel/sched/fair.c
> > > @@ -5747,7 +5747,16 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p,
> > >  		prev_eff_load *= 100 + (sd->imbalance_pct - 100) / 2;
> > >  	prev_eff_load *= capacity_of(this_cpu);
> > >  
> > > -	return this_eff_load <= prev_eff_load ? this_cpu : nr_cpumask_bits;
> > > +	/*
> > > +	 * If sync, adjust the weight of prev_eff_load such that if
> > > +	 * prev_eff == this_eff that select_idle_sibling will consider
> > > +	 * stacking the wakee on top of the waker if no other CPU is
> > > +	 * idle.
> > > +	 */
> > > +	if (sync)
> > > +		prev_eff_load += 1;
> > 
> > So where we had <= and would consistently favour pulling the task to the
> > waking CPU when all else what equal, you now switch to <, such that when
> > things are equal we do not pull.
> > 
> > That makes sense I suppose.
> > 
> > Except for sync wakeups, where you say, if everything else is equal,
> > pull, which also makes sense, because sync says 'current' promises to go
> > away.
> > 
> > OK.
> 
> Tasks tend to not honor that promise.. a lot.  Even if the sync hint
> were a golden promise, it wouldn't be bullet proof: migrating a compute
> hog based on a single "phoned home" wakeup remains a bad idea whether
> schedule() is called immediately after the wakeup or not.  It's a pain,
> only useful informational content is "this is a communication wakeup".
> 

Agreed and I'm aware of the hazard of sync wakeups being no guarantee
that the task will immediately sleep. If there is any delay at all then
stacking incurs a wakeup latency penalty but in many cases, it'll be an
idle sibling that is used. The sync hint does give a stronger hint that the
tasks are closely related though which is why I special-cased it slightly
and I feel it's justified. I think in all cases where it mattered, it was
due to pref_eff_load and this_eff_load begin equal to 0 when waking a task
via a socket.

-- 
Mel Gorman
SUSE Labs

  parent reply	other threads:[~2018-02-12 20:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 14:58 [PATCH 0/4] Reduce migrations due to load imbalance and process exits Mel Gorman
2018-02-12 14:58 ` [PATCH 1/4] sched/fair: Avoid an unnecessary lookup of current CPU ID during wake_affine Mel Gorman
2018-02-12 14:58 ` [PATCH 2/4] sched/fair: Defer calculation of prev_eff_load in wake_affine until needed Mel Gorman
2018-02-12 14:58 ` [PATCH 3/4] sched/fair: Do not migrate on wake_affine_weight if weights are equal Mel Gorman
2018-02-12 17:29   ` Peter Zijlstra
2018-02-12 17:43     ` Mel Gorman
2018-02-12 19:14     ` Mike Galbraith
2018-02-12 19:57       ` Peter Zijlstra
2018-02-12 20:20       ` Mel Gorman [this message]
2018-02-12 14:58 ` [PATCH 4/4] sched/fair: Do not migrate due to a sync wakeup on exit Mel Gorman
2018-02-12 17:31   ` Peter Zijlstra
2018-02-12 17:47     ` Mel Gorman
2018-02-12 18:01       ` Mel Gorman
2018-02-12 20:01   ` Andreas Mohr
2018-02-12 20:09     ` Mel Gorman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180212202040.hebvzfpdzglx4miq@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®