linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Damm <magnus@valinux.co.jp>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Magnus Damm <magnus@valinux.co.jp>, pj@sgi.com, ak@suse.de
Subject: [PATCH 05/05] NUMA: find_next_best_node fix
Date: Thu, 10 Nov 2005 18:08:29 +0900 (JST)	[thread overview]
Message-ID: <20051110090946.8083.42039.sendpatchset@cherry.local> (raw)
In-Reply-To: <20051110090920.8083.54147.sendpatchset@cherry.local>

Fix find_next_best_node() to support node masks with holes.

find_next_best_node() does currently not support node masks with holes. For 
instance, a node mask with nodes 1, 8 and 16 online will not work correctly.
The use of % num_online_nodes() in the code below hints that only a single 
contiguous range of nodes is supported without this patch.

Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
---

 page_alloc.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

--- from-0002/mm/page_alloc.c
+++ to-work/mm/page_alloc.c	2005-11-09 17:48:24.000000000 +0900
@@ -1554,26 +1554,31 @@ static int __initdata node_load[MAX_NUMN
  */
 static int __init find_next_best_node(int node, nodemask_t *used_node_mask)
 {
-	int i, n, val;
+	int n, val;
 	int min_val = INT_MAX;
 	int best_node = -1;
+	int first_node = node;
 
-	for_each_online_node(i) {
+	/* Use the local node if we haven't already */
+	if (node_isset(node, *used_node_mask))
+		n = !first_node;
+	else {
+		n = first_node;
+		best_node = node;
+	}
+
+	for (; n != first_node; node = n) {
 		cpumask_t tmp;
 
-		/* Start from local node */
-		n = (node+i) % num_online_nodes();
+		n = next_node(node, node_online_map);
+
+		if (n == MAX_NUMNODES)
+			n = first_node(node_online_map);
 
 		/* Don't want a node to appear more than once */
 		if (node_isset(n, *used_node_mask))
 			continue;
 
-		/* Use the local node if we haven't already */
-		if (!node_isset(node, *used_node_mask)) {
-			best_node = node;
-			break;
-		}
-
 		/* Use the distance array to find the distance */
 		val = node_distance(node, n);
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      parent reply	other threads:[~2005-11-10  9:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-10  9:08 [PATCH 00/05][RFC] NUMA emulation update Magnus Damm
2005-11-10  9:08 ` [PATCH 01/05] NUMA: Generic code Magnus Damm
2005-11-11  4:16   ` Andi Kleen
2005-11-15  8:34     ` Magnus Damm
2005-11-15 14:15       ` Andi Kleen
2005-11-16  5:22         ` Magnus Damm
2005-11-16  7:48           ` Andi Kleen
2005-11-16  7:57             ` Magnus Damm
2005-11-16  8:38               ` Andi Kleen
2005-11-16 11:31               ` Werner Almesberger
2005-11-10  9:08 ` [PATCH 02/05] x86_64: NUMA cleanup Magnus Damm
2005-11-10  9:08 ` [PATCH 03/05] x86_64: NUMA emulation Magnus Damm
2005-11-10  9:08 ` [PATCH 04/05] x86_64: NUMA without SMP Magnus Damm
2005-11-10  9:08 ` Magnus Damm [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=20051110090946.8083.42039.sendpatchset@cherry.local \
    --to=magnus@valinux.co.jp \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pj@sgi.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