[PATCH v4 52/55] selftests/mm: va_high_addr_switch: add setup of HugeTLB pages

From: Mike Rapoport

Date: Mon May 11 2026 - 12:46:26 EST


From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>

va_high_addr_switch skips HugeTLB tests 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.

Reviewed-by: Luiz Capitulino <luizcap@xxxxxxxxxx>
Tested-by: Luiz Capitulino <luizcap@xxxxxxxxxx>
Tested-by: Sarthak Sharma <sarthak.sharma@xxxxxxx>
Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
---
tools/testing/selftests/mm/va_high_addr_switch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/va_high_addr_switch.c b/tools/testing/selftests/mm/va_high_addr_switch.c
index 0b69bd4b901d..e24d7ba00b44 100644
--- a/tools/testing/selftests/mm/va_high_addr_switch.c
+++ b/tools/testing/selftests/mm/va_high_addr_switch.c
@@ -325,7 +325,7 @@ int main(int argc, char **argv)
if (!supported_arch())
ksft_exit_skip("Architecture not supported\n");

- if (argc == 2 && !strcmp(argv[1], "--run-hugetlb"))
+ if (hugetlb_setup_default(6))
run_hugetlb = true;

testcases_init();
--
2.53.0