public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vladimir Davydov <vdavydov@parallels.com>
Cc: Ingo Molnar <mingo@kernel.org>, Paul Turner <pjt@google.com>,
	linux-kernel@vger.kernel.org, devel@openvz.org
Subject: Re: [PATCH 2/2] sched: load_balance: Reset env when going to redo due to all pinned
Date: Mon, 16 Sep 2013 10:16:35 +0200	[thread overview]
Message-ID: <20130916081635.GQ21832@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <5236BC9B.8040006@parallels.com>

On Mon, Sep 16, 2013 at 12:08:59PM +0400, Vladimir Davydov wrote:
> >>Signed-off-by: Vladimir Davydov<vdavydov@parallels.com>
> >>---
> >>  kernel/sched/fair.c |   12 ++++++++++--
> >>  1 file changed, 10 insertions(+), 2 deletions(-)
> >>
> >>diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> >>index cd59640..d840e51 100644
> >>--- a/kernel/sched/fair.c
> >>+++ b/kernel/sched/fair.c
> >>@@ -5289,8 +5289,16 @@ more_balance:
> >>  		if (unlikely(env.flags & LBF_ALL_PINNED)) {
> >>  			cpumask_clear_cpu(cpu_of(busiest), cpus);
> >>  			if (!cpumask_empty(cpus)) {
> >>-				env.loop = 0;
> >>-				env.loop_break = sched_nr_migrate_break;
> >>+				env.dst_cpu	= this_cpu;
> >>+				env.dst_rq	= this_rq;
> >>+				env.flags	= 0;
> >>+				env.loop	= 0;
> >>+				env.loop_break	= sched_nr_migrate_break;
> >>+
> >>+				/* Reset cpus cleared in LBF_SOME_PINNED case */
> >>+				if (env.dst_grpmask)
> >>+					cpumask_or(cpus, cpus, env.dst_grpmask);
> >>+
> >>  				goto redo;
> >>  			}
> >>  			goto out_balanced;
> >So the problem I have with this is that it removes the bound on the
> >number of iterations we do. Currently we're limited by the bits in cpus,
> >but by resetting those we can do on and on and on...
> 
> find_busiest_group() never selects the local group, doesn't it? So none of
> env.dst_grpmask, which is initialized to sched_group_cpus(this_rq->sd), can
> be selected for the source cpu. That said, resetting env.dst_grpmask bits in
> the cpus bitmask actually doesn't affect the number of balance iterations.

Going by e02e60c10 the bits in cpus are what limit the DST_PINNED
(formerly SOME_PINNED) retry loop.

But yes, as you said, the entire scenario is entirely unlikely. I'll
drop this patch for now.

  reply	other threads:[~2013-09-16  8:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-15 17:30 [PATCH 1/2] sched: load_balance: Prevent reselect prev dst_cpu if some pinned Vladimir Davydov
2013-09-15 17:30 ` [PATCH 2/2] sched: load_balance: Reset env when going to redo due to all pinned Vladimir Davydov
2013-09-16  5:43   ` Peter Zijlstra
2013-09-16  8:08     ` Vladimir Davydov
2013-09-16  8:16       ` Peter Zijlstra [this message]
2013-09-16  8:08 ` [PATCH 1/2] sched: load_balance: Prevent reselect prev dst_cpu if some pinned Peter Zijlstra
2013-09-20 13:47 ` [tip:sched/core] sched/balancing: Prevent the reselection of a previous env.dst_cpu if some tasks are pinned tip-bot for Vladimir Davydov

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=20130916081635.GQ21832@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=devel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pjt@google.com \
    --cc=vdavydov@parallels.com \
    /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