[LTP] [RFC][PATCH 2/2] Use safe_get_nodemap()
Cyril Hrubis
chrubis@suse.cz
Mon Mar 31 18:06:26 CEST 2025
Hi!
> --- a/testcases/kernel/mem/ksm/ksm06.c
> +++ b/testcases/kernel/mem/ksm/ksm06.c
> @@ -124,9 +124,7 @@ static void setup(void)
>
> page_size = getpagesize();
>
> - nodes = tst_get_nodemap(TST_NUMA_MEM, nr_pages * page_size / 1024);
> - if (nodes->cnt <= 1)
> - tst_brk(TCONF, "Test requires at least two NUMA memory nodes");
> + nodes = safe_get_nodemap(TST_NUMA_MEM, nr_pages * page_size / 1024, 2);
> }
>
> static struct tst_test test = {
> diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
> index 3c854d1096..031c35f40e 100644
> --- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
> +++ b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
> @@ -142,9 +142,7 @@ static void setup(void)
> {
> unsigned int i;
>
> - node = tst_get_nodemap(TST_NUMA_MEM, PAGES_ALLOCATED * getpagesize() / 1024);
> - if (node->cnt < 1)
> - tst_brk(TCONF, "test requires at least one NUMA memory node");
> + node = safe_get_nodemap(TST_NUMA_MEM, PAGES_ALLOCATED * getpagesize() / 1024, 1);
Hmm, we are actually requesting at least 1 node.
The question is if we shouldn't change this. It's very unlikely that we
get wrong answer about on which node memory has been allocated if there
is only one node.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list