mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov@parallels.com>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@kernel.org>
Cc: Paul Turner <pjt@google.com>, <linux-kernel@vger.kernel.org>,
	<devel@openvz.org>
Subject: [PATCH 2/2] sched: load_balance: Reset env when going to redo due to all pinned
Date: Sun, 15 Sep 2013 21:30:14 +0400	[thread overview]
Message-ID: <c34e2ebbe55403d5db111fa3ecdf6ca52b73a337.1379265590.git.vdavydov@parallels.com> (raw)
In-Reply-To: <281f59b6e596c718dd565ad267fc38f5b8e5c995.1379265590.git.vdavydov@parallels.com>

Firstly, reset env.dst_cpu/dst_rq to this_cpu/this_rq, because it could
have changed in 'some pinned' case. Otherwise, should_we_balance() can
stop balancing beforehand.

Secondly, reset env.flags, because it can have LBF_SOME_PINNED set.

Thirdly, reset env.dst_grpmask cpus in env.cpus to allow handling 'some
pinned' case when pulling tasks from a new busiest cpu.

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;
-- 
1.7.10.4


  reply	other threads:[~2013-09-15 17:30 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 ` Vladimir Davydov [this message]
2013-09-16  5:43   ` [PATCH 2/2] sched: load_balance: Reset env when going to redo due to all pinned Peter Zijlstra
2013-09-16  8:08     ` Vladimir Davydov
2013-09-16  8:16       ` Peter Zijlstra
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=c34e2ebbe55403d5db111fa3ecdf6ca52b73a337.1379265590.git.vdavydov@parallels.com \
    --to=vdavydov@parallels.com \
    --cc=devel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.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

all inboxes | Powered by JetHome®