Skip to content

Commit a5b7620

Browse files
surenbaghdasaryanakpm00
authored andcommitted
selftests/mm: add separate UFFDIO_MOVE test for PMD splitting
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/20231230025636.2477429-1-surenb@google.com Signed-off-by: Suren Baghdasaryan <surenb@google.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: Brian Geffon <bgeffon@google.com> Cc: Christian Brauner <brauner@kernel.org> Cc: David Hildenbrand <david@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Jann Horn <jannh@google.com> Cc: Kalesh Singh <kaleshsingh@google.com> Cc: Liam R. Howlett <Liam.Howlett@oracle.com> Cc: Lokesh Gidra <lokeshgidra@google.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport (IBM) <rppt@kernel.org> Cc: Nicolas Geoffray <ngeoffray@google.com> Cc: Peter Xu <peterx@redhat.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Shuah Khan <shuah@kernel.org> Cc: ZhangPeng <zhangpeng362@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 8c9eea7 commit a5b7620

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tools/testing/selftests/mm/uffd-unit-tests.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,16 @@ static void uffd_move_test(uffd_test_args_t *targs)
11991199

12001200
static void uffd_move_pmd_test(uffd_test_args_t *targs)
12011201
{
1202+
if (madvise(area_dst, nr_pages * page_size, MADV_HUGEPAGE))
1203+
err("madvise(MADV_HUGEPAGE) failure");
1204+
uffd_move_test_common(targs, read_pmd_pagesize(),
1205+
uffd_move_pmd_handle_fault);
1206+
}
1207+
1208+
static void uffd_move_pmd_split_test(uffd_test_args_t *targs)
1209+
{
1210+
if (madvise(area_dst, nr_pages * page_size, MADV_NOHUGEPAGE))
1211+
err("madvise(MADV_NOHUGEPAGE) failure");
12021212
uffd_move_test_common(targs, read_pmd_pagesize(),
12031213
uffd_move_pmd_handle_fault);
12041214
}
@@ -1330,6 +1340,13 @@ uffd_test_case_t uffd_tests[] = {
13301340
.uffd_feature_required = UFFD_FEATURE_MOVE,
13311341
.test_case_ops = &uffd_move_test_pmd_case_ops,
13321342
},
1343+
{
1344+
.name = "move-pmd-split",
1345+
.uffd_fn = uffd_move_pmd_split_test,
1346+
.mem_targets = MEM_ANON,
1347+
.uffd_feature_required = UFFD_FEATURE_MOVE,
1348+
.test_case_ops = &uffd_move_test_pmd_case_ops,
1349+
},
13331350
{
13341351
.name = "wp-fork",
13351352
.uffd_fn = uffd_wp_fork_test,

0 commit comments

Comments
 (0)