[PATCH] numactl-2.0.9~rc5/libnuma.c numa_node_of_cpu()

Thierry Fauck@linux.vnet.ibm.com thierry at linux.vnet.ibm.com
Tue Nov 18 16:31:41 UTC 2014


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

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

---

Index: numactl-2.0.9~rc5/libnuma.c
===================================================================
--- numactl-2.0.9~rc5.orig/libnuma.c
+++ numactl-2.0.9~rc5/libnuma.c
@@ -1403,10 +1403,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;

-- 
Thierry Fauck @ linux.vnet.ibm





More information about the Ubuntu-devel-discuss mailing list