Re: [PATCH v3 43/54] selftests/mm: hugetlb-vmemmap: add setup of HugeTLB pages
From: Sarthak Sharma
Date: Thu May 07 2026 - 07:29:33 EST
On 4/29/26 2:12 AM, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>
>
> hugetlb-vmemmap test fails if there are no free huge pages prepared by a
> wrapper script.
>
> Add setup of HugeTLB pages to the test and make sure that the original
> settings are restored on the test exit.
>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
I have run the test before and after applying the patch. Before the
patch, the test bailed out with mmap error if there was not exactly 1
free hugepage. After the patch, the test correctly allocates the
hugepage and successfully passes, restoring the hugepage settings at exit.
Tested-by: Sarthak Sharma <sarthak.sharma@xxxxxxx>
> ---
> tools/testing/selftests/mm/hugetlb-vmemmap.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/hugetlb-vmemmap.c b/tools/testing/selftests/mm/hugetlb-vmemmap.c
> index af5786bebfd1..507df78a158d 100644
> --- a/tools/testing/selftests/mm/hugetlb-vmemmap.c
> +++ b/tools/testing/selftests/mm/hugetlb-vmemmap.c
> @@ -97,6 +97,9 @@ int main(int argc, char **argv)
> ksft_print_header();
> ksft_set_plan(1);
>
> + if (!hugetlb_setup_default(1))
> + ksft_exit_skip("Not enough free huge pages\n");
> +
> pagesize = psize();
> maplength = default_huge_page_size();
> if (!maplength)