Skip to contentSkip to conversation

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

PATCH New Thierry FAUCK - IBM LTC 1 participant 1 message Dec 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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. .

From: Thierry Fauck <[email protected]>

modified: libnuma.c

---
 libnuma.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
libnuma.c +6 -4
index 91425ae..5961df5 100644
@@ -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;
Signature · 1 line
2.1.0