From: Cliff Wickman <cpw@xxxxxxx> Replace my own erroneous patch: 1010_cw_numa_get_run_node_mask. That patch replaced numa_get_run_node_mask_v2()'s logic with simply returning a copy of the bitmask numa_all_nodes_ptr, as that mask is cpuset aware. But that mask is not updated when task cpu affinity is changed. When numactl --show called this function it was getting all the nodes in the cpuset rather than the affined cpus. That error was the cause of the regression exposed by test/checkaffinity. So the original logic of that function (before my patch) is simply enhanced to only consider nodes within the current cpuset. And similarly, numa_run_on_node_mask_v2() is enhanced. (It is given a mask of nodes, and is to create a mask of cpu's that are on those nodes. Then sets affinity to those cpu's.) It is enhanced to only consider nodes within the current cpuset. Tested on 96p, 10 nodes. Both inside and outside of a restrictive cpuset. Tested with 'make test' and the qthreads 'make check'. The only failure happens when the test/checkaffinity script tries to set affinity outside of the current cpuset. So that script should probably be enhanced to check for those boundaries. Signed-off-by: Cliff Wickman <cpw@xxxxxxx> --- libnuma.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) Index: numactl-dev/libnuma.c =================================================================== --- numactl-dev.orig/libnuma.c +++ numactl-dev/libnuma.c @@ -1495,6 +1495,15 @@ numa_run_on_node_mask_v2(struct bitmask if (bmp->maskp[i / BITS_PER_LONG] == 0) continue; if (numa_bitmask_isbitset(bmp, i)) { + /* + * numa_all_nodes_ptr is cpuset aware; use only + * these nodes + */ + if (!numa_bitmask_isbitset(numa_all_nodes_ptr, i)) { + numa_warn(W_noderunmask, + "node %d not allowed", i); + continue; + } if (numa_node_to_cpus_v2_int(i, nodecpus) < 0) { numa_warn(W_noderunmask, "Cannot read node cpumask from sysfs"); @@ -1574,6 +1583,13 @@ numa_get_run_node_mask_v2(void) nodecpus = numa_allocate_cpumask(); for (i = 0; i <= max; i++) { + /* + * numa_all_nodes_ptr is cpuset aware; show only + * these nodes + */ + if (!numa_bitmask_isbitset(numa_all_nodes_ptr, i)) { + continue; + } if (numa_node_to_cpus_v2_int(i, nodecpus) < 0) { /* It's possible for the node to not exist */ continue; -- 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