On 4/29/26 2:12 AM, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <[email protected]>
> 
> 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) <[email protected]>

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 <[email protected]>

> ---
>  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)


Reply via email to