linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry FAUCK - IBM LTC <thierry@linux.vnet.ibm.com>
To: linux-numa@vger.kernel.org
Cc: cpw@sgi.com, Thierry Fauck <thierry@linux.vnet.ibm.com>
Subject: [PATCH] libnuma_node_not_sequential         libnuma.so function numa_node_of_cpu() doesn't use previously created list of valid nodes but use the entire array indexed with the maximum number of nodes available on the system. Fix is to check node is valid before calling numa_node_to_cpus_v2_int() which check that the cpu belongs to that node. .
Date: Tue,  9 Dec 2014 16:56:07 +0100	[thread overview]
Message-ID: <1418140567-15677-1-git-send-email-thierry@linux.vnet.ibm.com> (raw)

From: Thierry Fauck <thierry@linux.vnet.ibm.com>

Signed-off-by: Thierry Fauck <thierry@linux.vnet.ibm.com>

	modified:   libnuma.c
---
 libnuma.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libnuma.c b/libnuma.c
index 91425ae..5961df5 100644
--- a/libnuma.c
+++ b/libnuma.c
@@ -1405,10 +1405,12 @@ int numa_node_of_cpu(int cpu)
 	bmp = numa_bitmask_alloc(ncpus);
 	nnodes = numa_max_node();
 	for (node = 0; node <= nnodes; node++){
-		numa_node_to_cpus_v2_int(node, bmp);
-		if (numa_bitmask_isbitset(bmp, cpu)){
-			ret = node;
-			goto end;
+		if (_getbit(numa_nodes_ptr,node)) {
+			numa_node_to_cpus_v2_int(node, bmp);
+			if (numa_bitmask_isbitset(bmp, cpu)){
+				ret = node;
+				goto end;
+			}
 		}
 	}
 	ret = -1;
-- 
2.1.0

                 reply	other threads:[~2014-12-09 15:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1418140567-15677-1-git-send-email-thierry@linux.vnet.ibm.com \
    --to=thierry@linux.vnet.ibm.com \
    --cc=cpw@sgi.com \
    --cc=linux-numa@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).