summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/mm/uffd-stress.c
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2023-04-12 19:43:31 +0300
committerAndrew Morton <akpm@linux-foundation.org>2023-04-19 02:30:05 +0300
commitc5cb903646f4df0ab3760dcb2e5571b528b6db59 (patch)
tree75c723a4347cffd5ad0d5c8220bccead103ea759 /tools/testing/selftests/mm/uffd-stress.c
parentd5433ce84d2572d43a3c58e5cab21db200669bfd (diff)
downloadlinux-c5cb903646f4df0ab3760dcb2e5571b528b6db59.tar.xz
selftests/mm: drop global mem_fd in uffd tests
Drop it by creating the memfd dynamically in the tests. Link: https://lkml.kernel.org/r/20230412164331.328584-1-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: David Hildenbrand <david@redhat.com> Cc: Dmitry Safonov <0x7f454c46@gmail.com> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Zach O'Keefe <zokeefe@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools/testing/selftests/mm/uffd-stress.c')
-rw-r--r--tools/testing/selftests/mm/uffd-stress.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c
index e6d39a755082..4eca1a0276c2 100644
--- a/tools/testing/selftests/mm/uffd-stress.c
+++ b/tools/testing/selftests/mm/uffd-stress.c
@@ -1090,21 +1090,6 @@ int main(int argc, char **argv)
}
nr_pages = nr_pages_per_cpu * nr_cpus;
- if (test_type == TEST_SHMEM || test_type == TEST_HUGETLB) {
- unsigned int memfd_flags = 0;
-
- if (test_type == TEST_HUGETLB)
- memfd_flags = MFD_HUGETLB;
- mem_fd = memfd_create(argv[0], memfd_flags);
- if (mem_fd < 0)
- err("memfd_create");
- if (ftruncate(mem_fd, nr_pages * page_size * 2))
- err("ftruncate");
- if (fallocate(mem_fd,
- FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0,
- nr_pages * page_size * 2))
- err("fallocate");
- }
printf("nr_pages: %lu, nr_pages_per_cpu: %lu\n",
nr_pages, nr_pages_per_cpu);
return userfaultfd_stress();