Comment 4 for bug 1358835

Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2014-11-18 15:49 EDT-------
We have found the issue - On a bare LE system, nodes are name 0, 1 , 16 , 17 and the library search for these nodes for the meminfo file however it search for nodes 0, 1, 2 for the cpumap file.
On a VM started by qemu, the nodes are named 0,1,2,3 and the problem doesn't occures.

In libnuma.c, 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.

$ diff -urN libnuma.c libnuma.c.new
--- libnuma.c 2014-11-18 10:44:32.563683894 -0500
+++ libnuma.c.new 2014-11-18 10:44:04.431683894 -0500
@@ -1403,10 +1403,12 @@
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;