diff options
author | Nico Pache <npache@redhat.com> | 2024-03-06 15:37:13 -0700 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-03-12 13:07:18 -0700 |
commit | 5a6aa60d18236c2f8ebc438db3e80e61714a8904 (patch) | |
tree | c3f57e81daac403ff3f814960a801f09a210ca78 /tools | |
parent | 2fd570c1d802e7d1b7df2fbc3784875686427f78 (diff) | |
download | linux-5a6aa60d18236c2f8ebc438db3e80e61714a8904.tar.gz linux-5a6aa60d18236c2f8ebc438db3e80e61714a8904.tar.bz2 linux-5a6aa60d18236c2f8ebc438db3e80e61714a8904.zip |
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/20240306223714.320681-3-npache@redhat.com
Signed-off-by: Nico Pache <npache@redhat.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/mm/uffd-stress.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c index 7e83829bbb33..f78bab0f3d45 100644 --- a/tools/testing/selftests/mm/uffd-stress.c +++ b/tools/testing/selftests/mm/uffd-stress.c @@ -441,6 +441,12 @@ int main(int argc, char **argv) parse_test_type_arg(argv[1]); bytes = atol(argv[2]) * 1024 * 1024; + if (test_type == TEST_HUGETLB && + get_free_hugepages() < bytes / page_size) { + printf("skip: Skipping userfaultfd... not enough hugepages\n"); + return KSFT_SKIP; + } + nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); nr_pages_per_cpu = bytes / page_size / nr_cpus; |