Skip to content

Commit 5a6aa60

Browse files
PacheNicoakpm00
authored andcommitted
selftests/mm: skip uffd hugetlb tests with insufficient hugepages
Now that run_vmtests.sh does not guarantee that the correct hugepage count is available, add a check inside the userfaultfd hugetlb test to verify the nr_hugepages count before continuing. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Nico Pache <[email protected]> Cc: Ben Hutchings <[email protected]> Cc: Muchun Song <[email protected]> Cc: Muhammad Usama Anjum <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 2fd570c commit 5a6aa60

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/testing/selftests/mm/uffd-stress.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,12 @@ int main(int argc, char **argv)
441441
parse_test_type_arg(argv[1]);
442442
bytes = atol(argv[2]) * 1024 * 1024;
443443

444+
if (test_type == TEST_HUGETLB &&
445+
get_free_hugepages() < bytes / page_size) {
446+
printf("skip: Skipping userfaultfd... not enough hugepages\n");
447+
return KSFT_SKIP;
448+
}
449+
444450
nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
445451

446452
nr_pages_per_cpu = bytes / page_size / nr_cpus;

0 commit comments

Comments
 (0)