linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [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. .
@ 2014-12-09 15:56 Thierry FAUCK - IBM LTC
  0 siblings, 0 replies; only message in thread
From: Thierry FAUCK - IBM LTC @ 2014-12-09 15:56 UTC (permalink / raw)
  To: linux-numa; +Cc: cpw, Thierry Fauck

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-09 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-09 15:56 [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. Thierry FAUCK - IBM LTC

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).