On Fri, May 25, 2012 at 2:12 AM, Jan Stancek <jstancek@...> wrote:
> Some setups can lack memory on arbitrary nodes, use only nodes
> returned by get_mempolicy(..., MPOL_F_MEMS_ALLOWED).
> Signed-off-by: Jan Stancek <jstancek@...>
> .../syscalls/move_pages/move_pages_support.c | 74 ++++++++++++++++----
> .../syscalls/move_pages/move_pages_support.h | 1 +
> 2 files changed, 62 insertions(+), 13 deletions(-)
+ if (syscall(__NR_get_mempolicy, NULL, allowed_nodemask->maskp,
+ allowed_nodemask->size, 0, MPOL_F_MEMS_ALLOWED) < 0)
+ tst_resm(TFAIL|TERRNO, "get_mempolicy: MPOL_F_MEMS_ALLOWED");
Would tst_brkm be better here? Also, what happens in the negative case
(HAVE_NUMA_H is not defined)? Wouldn't that segfault accessing random
memory or something along those lines?
I think it would be better to design the API (get_allowed_nodes) to
return an integer value to denote success or failure, then test for
that in main and report errors there.