From: Thierry Fauck <thierry@xxxxxxxxxxxxxxxxxx> Signed-off-by: Thierry Fauck <thierry@xxxxxxxxxxxxxxxxxx> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-numa" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html