mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: riel@redhat.com
To: linux-kernel@vger.kernel.org
Cc: chegu_vinod@hp.com, peterz@infradead.org, mingo@redhat.com,
	mgorman@suse.de
Subject: [PATCH 6/6] sched,numa: check all nodes when placing a pseudo-interleaved group
Date: Fri, 17 Oct 2014 03:29:54 -0400	[thread overview]
Message-ID: <1413530994-9732-7-git-send-email-riel@redhat.com> (raw)
In-Reply-To: <1413530994-9732-1-git-send-email-riel@redhat.com>

From: Rik van Riel <riel@redhat.com>

In pseudo-interleaved numa_groups, all tasks try to relocate to
the group's preferred_nid.  When a group is spread across multiple
NUMA nodes, this can lead to tasks swapping their location with
other tasks inside the same group, instead of having the group
converge on a few nodes.

When placing a task in a pseudo-interleaved numa_group, it pays
to examine all nodes, to see if it isn't better to move to eg.
the #2 node, so the group locality can be improved.

Signed-off-by: Rik van Riel <riel@redhat.com>
Tested-by: Chegu Vinod <chegu_vinod@hp.com>
---
 kernel/sched/fair.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b973d77..00c1137 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1425,8 +1425,15 @@ static int task_numa_migrate(struct task_struct *p)
 	/* Try to find a spot on the preferred nid. */
 	task_numa_find_cpu(&env, taskimp, groupimp);
 
-	/* No space available on the preferred nid. Look elsewhere. */
-	if (env.best_cpu == -1) {
+	/*
+	 * Look at other nodes in these cases:
+	 * - there is no space available on the preferred_nid
+	 * - the task is part of a numa_group that is interleaved across
+	 *   multiple NUMA nodes; in order to better consolidate the group,
+	 *   we need to check other locations.
+	 */
+	if (env.best_cpu == -1 || (p->numa_group &&
+			nodes_weight(p->numa_group->active_nodes) > 1)) {
 		for_each_online_node(nid) {
 			if (nid == env.src_nid || nid == p->numa_preferred_nid)
 				continue;
-- 
1.9.3


      parent reply	other threads:[~2014-10-17  7:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17  7:29 [PATCH 0/6] sched,numa: weigh nearby nodes for task placement on complex NUMA topologies (v2) riel
2014-10-17  7:29 ` [PATCH 1/6] sched,numa: export info needed for NUMA balancing on complex topologies riel
2014-10-28 11:04   ` [tip:sched/core] sched/numa: Export " tip-bot for Rik van Riel
2014-10-17  7:29 ` [PATCH 2/6] sched,numa: classify the NUMA topology of a system riel
2014-10-28 11:04   ` [tip:sched/core] sched/numa: Classify " tip-bot for Rik van Riel
2014-10-17  7:29 ` [PATCH 3/6] sched,numa: preparations for complex topology placement riel
2014-10-28 11:04   ` [tip:sched/core] sched/numa: Prepare " tip-bot for Rik van Riel
2014-10-17  7:29 ` [PATCH 4/6] sched,numa: calculate node scores in complex NUMA topologies riel
2014-10-28 11:04   ` [tip:sched/core] sched/numa: Calculate " tip-bot for Rik van Riel
2014-10-17  7:29 ` [PATCH 5/6] sched,numa: find the preferred nid with complex NUMA topology riel
2014-10-28 11:05   ` [tip:sched/core] sched/numa: Find " tip-bot for Rik van Riel
2014-10-17  7:29 ` riel [this message]

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=1413530994-9732-7-git-send-email-riel@redhat.com \
    --to=riel@redhat.com \
    --cc=chegu_vinod@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --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

Powered by JetHome