]> Git Repo - linux.git/commitdiff
selftests/mm: add separate UFFDIO_MOVE test for PMD splitting
authorSuren Baghdasaryan <[email protected]>
Sat, 30 Dec 2023 02:56:36 +0000 (18:56 -0800)
committerAndrew Morton <[email protected]>
Fri, 5 Jan 2024 18:17:49 +0000 (10:17 -0800)
Add a test for UFFDIO_MOVE ioctl operating on a hugepage which has to be
split because destination is marked with MADV_NOHUGEPAGE.  With this we
cover all 3 cases: normal page move, hugepage move, hugepage splitting
before move.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Suren Baghdasaryan <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Axel Rasmussen <[email protected]>
Cc: Brian Geffon <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: Kalesh Singh <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Lokesh Gidra <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Mike Rapoport (IBM) <[email protected]>
Cc: Nicolas Geoffray <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: Ryan Roberts <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: ZhangPeng <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
tools/testing/selftests/mm/uffd-unit-tests.c

index d8091523c2dfef4ef2f10bb121853aa4d4f0ddd2..cce90a10515ad2fe78fe68147d26732d717c3bb6 100644 (file)
@@ -1199,6 +1199,16 @@ static void uffd_move_test(uffd_test_args_t *targs)
 
 static void uffd_move_pmd_test(uffd_test_args_t *targs)
 {
+       if (madvise(area_dst, nr_pages * page_size, MADV_HUGEPAGE))
+               err("madvise(MADV_HUGEPAGE) failure");
+       uffd_move_test_common(targs, read_pmd_pagesize(),
+                             uffd_move_pmd_handle_fault);
+}
+
+static void uffd_move_pmd_split_test(uffd_test_args_t *targs)
+{
+       if (madvise(area_dst, nr_pages * page_size, MADV_NOHUGEPAGE))
+               err("madvise(MADV_NOHUGEPAGE) failure");
        uffd_move_test_common(targs, read_pmd_pagesize(),
                              uffd_move_pmd_handle_fault);
 }
@@ -1330,6 +1340,13 @@ uffd_test_case_t uffd_tests[] = {
                .uffd_feature_required = UFFD_FEATURE_MOVE,
                .test_case_ops = &uffd_move_test_pmd_case_ops,
        },
+       {
+               .name = "move-pmd-split",
+               .uffd_fn = uffd_move_pmd_split_test,
+               .mem_targets = MEM_ANON,
+               .uffd_feature_required = UFFD_FEATURE_MOVE,
+               .test_case_ops = &uffd_move_test_pmd_case_ops,
+       },
        {
                .name = "wp-fork",
                .uffd_fn = uffd_wp_fork_test,
This page took 0.065011 seconds and 4 git commands to generate.