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:33 +0300
committerAndrew Morton <akpm@linux-foundation.org>2023-04-19 02:30:06 +0300
commit265818ef988b3a4cd12fc8885966413b78f06d96 (patch)
tree03776ea08b7cc73c109640fe89efd8d4913b9b65 /tools/testing/selftests/mm/uffd-stress.c
parentc5cb903646f4df0ab3760dcb2e5571b528b6db59 (diff)
downloadlinux-265818ef988b3a4cd12fc8885966413b78f06d96.tar.xz
selftests/mm: drop global hpage_size in uffd tests
hpage_size was wrongly used. Sometimes it means hugetlb default size, sometimes it was used as thp size. Remove the global variable and use the right one at each place. Link: https://lkml.kernel.org/r/20230412164333.328596-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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c
index 4eca1a0276c2..54fc9b4ffa3c 100644
--- a/tools/testing/selftests/mm/uffd-stress.c
+++ b/tools/testing/selftests/mm/uffd-stress.c
@@ -655,7 +655,7 @@ static int userfaultfd_minor_test(void)
uffd_test_ops->check_pmd_mapping(area_dst,
nr_pages * page_size /
- hpage_size);
+ read_pmd_pagesize());
/*
* This won't cause uffd-fault - it purely just makes sure there
* was no corruption.
@@ -997,7 +997,7 @@ static void parse_test_type_arg(const char *raw_type)
err("Unsupported test: %s", raw_type);
if (test_type == TEST_HUGETLB)
- page_size = hpage_size;
+ page_size = default_huge_page_size();
else
page_size = sysconf(_SC_PAGE_SIZE);
@@ -1035,6 +1035,7 @@ static void sigalrm(int sig)
int main(int argc, char **argv)
{
size_t bytes;
+ size_t hpage_size = read_pmd_pagesize();
if (argc < 4)
usage();
@@ -1043,7 +1044,6 @@ int main(int argc, char **argv)
err("failed to arm SIGALRM");
alarm(ALARM_INTERVAL_SECS);
- hpage_size = default_huge_page_size();
parse_test_type_arg(argv[1]);
bytes = atol(argv[2]) * 1024 * 1024;