[PATCH 42/53] selftests/mm: hugetlb-vmemmap: add setup of HugeTLB pages

Mike Rapoport
2026-04-06T14:21:53Z

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@kernel.org>
---
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)
--
2.53.0