Skip to content

Commit 0ecb423

Browse files
Sebastian Andrzej SiewiorPeter Zijlstra
authored andcommitted
selftests/futex: Set the home_node in futex_numa_mpol
The test fails at the MPOL step if multiple nodes are available. The reason is that mbind() sets the policy but the home_node, which is retrieved by the futex code, is not set. This causes to retrieve the current node and with multiple nodes it fails on one of the iterations. Use numa_set_mempolicy_home_node() to set the expected node. Use ksft_exit_fail_msg() to fail and exit in order not to confuse ktap. Fixes: 3163369 ("selftests/futex: Add futex_numa_mpol") Suggested-by: Vlastimil Babka <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 1a9dcf6 commit 0ecb423

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/testing/selftests/futex/functional/futex_numa_mpol.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ int main(int argc, char *argv[])
210210
ret = mbind(futex_ptr, mem_size, MPOL_BIND, &nodemask,
211211
sizeof(nodemask) * 8, 0);
212212
if (ret == 0) {
213+
ret = numa_set_mempolicy_home_node(futex_ptr, mem_size, i, 0);
214+
if (ret != 0)
215+
ksft_exit_fail_msg("Failed to set home node: %m, %d\n", errno);
216+
213217
ksft_print_msg("Node %d test\n", i);
214218
futex_numa->futex = 0;
215219
futex_numa->numa = FUTEX_NO_NODE;
@@ -220,8 +224,8 @@ int main(int argc, char *argv[])
220224
if (0)
221225
test_futex_mpol(futex_numa, 0);
222226
if (futex_numa->numa != i) {
223-
ksft_test_result_fail("Returned NUMA node is %d expected %d\n",
224-
futex_numa->numa, i);
227+
ksft_exit_fail_msg("Returned NUMA node is %d expected %d\n",
228+
futex_numa->numa, i);
225229
}
226230
}
227231
}

0 commit comments

Comments
 (0)