* Re: [PATCH] selftests/mm: hugetlb_madv_vs_map: fix TAP plan mismatches
2026-10-04 23:00 ` [PATCH] selftests/mm: hugetlb_madv_vs_map: fix TAP plan mismatches Jaeyeon Lee
@ 2026-10-05 10:40 ` David Hildenbrand (Arm)
2026-10-05 11:12 ` Sarthak Sharma
1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand (Arm) @ 2026-10-05 10:40 UTC (permalink / raw)
To: Jaeyeon Lee, Andrew Morton, Guillaume Morin
Cc: Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Breno Leitao,
linux-mm, linux-kselftest, linux-kernel
On 10/5/26 01:00, Jaeyeon Lee wrote:
> The plan was raised from 1 to 3, but the HugeTLB setup check that may
> call ksft_exit_skip() still runs after ksft_set_plan(), so a setup
> failure reports one result against a plan of 3. Move ksft_set_plan()
> below the setup check.
>
> Also, when the underflow check fails, or munmap() fails,
> test_underflow() jumps to err_cleanup and exits without reporting the
> remaining results. Report the munmap() failure as a test result and
> skip the final HugePages_Rsvd check in err_cleanup, so the output
> always contains the planned 3 results.
>
> Fixes: 827149aad495 ("selftests/mm: hugetlb_madv_vs_map: add underflow test")
> Assisted-by: LLM
> Signed-off-by: Jaeyeon Lee <jaeyeon.lee.dev@gmail.com>
> ---
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] selftests/mm: hugetlb_madv_vs_map: fix TAP plan mismatches
2026-10-04 23:00 ` [PATCH] selftests/mm: hugetlb_madv_vs_map: fix TAP plan mismatches Jaeyeon Lee
2026-10-05 10:40 ` David Hildenbrand (Arm)
@ 2026-10-05 11:12 ` Sarthak Sharma
1 sibling, 0 replies; 3+ messages in thread
From: Sarthak Sharma @ 2026-10-05 11:12 UTC (permalink / raw)
To: Jaeyeon Lee, Andrew Morton, Guillaume Morin
Cc: David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Shuah Khan, Breno Leitao, linux-mm, linux-kselftest,
linux-kernel
Hi Jaeyeon!
On 10/5/26 4:30 AM, Jaeyeon Lee wrote:
> The plan was raised from 1 to 3, but the HugeTLB setup check that may
> call ksft_exit_skip() still runs after ksft_set_plan(), so a setup
> failure reports one result against a plan of 3. Move ksft_set_plan()
> below the setup check.
>
> Also, when the underflow check fails, or munmap() fails,
> test_underflow() jumps to err_cleanup and exits without reporting the
> remaining results. Report the munmap() failure as a test result and
> skip the final HugePages_Rsvd check in err_cleanup, so the output
> always contains the planned 3 results.
>
> Fixes: 827149aad495 ("selftests/mm: hugetlb_madv_vs_map: add underflow test")
> Assisted-by: LLM
> Signed-off-by: Jaeyeon Lee <jaeyeon.lee.dev@gmail.com>
> ---
> tools/testing/selftests/mm/hugetlb_madv_vs_map.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/hugetlb_madv_vs_map.c b/tools/testing/selftests/mm/hugetlb_madv_vs_map.c
> index 1d111f42dd59..5dc44ff0a377 100644
> --- a/tools/testing/selftests/mm/hugetlb_madv_vs_map.c
> +++ b/tools/testing/selftests/mm/hugetlb_madv_vs_map.c
> @@ -169,6 +169,7 @@ void test_underflow(void)
> /* First unmap, this will close the vma */
> if (munmap(huge_ptr, mmap_size) != 0) {
> ksft_perror("munmap failed");
> + ksft_test_result_fail("munmap failed\n");
This is duplicating the "munmap failed" message. Can we simply put a
ksft_test_result_fail("munmap failed: %s (%d)\n", strerror(errno),
errno) here?
Also, please send your patch in a new thread instead of replying on
another thread from next time onwards :)
> goto err_cleanup;
> }
>
> @@ -203,18 +204,20 @@ void test_underflow(void)
> if (waitpid(pid, NULL, 0) <= 0)
> ksft_exit_fail_perror("waitpid failed");
>
> + ksft_test_result_skip("HugePages_Rsvd check after child exit\n");
> ksft_exit_fail();
> }
>
> int main(void)
> {
> ksft_print_header();
> - ksft_set_plan(3);
>
> if (!hugetlb_setup_default_exact(1))
> ksft_exit_skip("This test needs one and only one page to execute. Got %lu\n",
> hugetlb_free_default_pages());
>
> + ksft_set_plan(3);
> +
> test_madv_vs_map();
> test_underflow();
>
^ permalink raw reply [flat|nested] 3+ messages in thread