linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] selftests/mm: add separate UFFDIO_MOVE test for PMD splitting
@ 2023-12-30  2:56 Suren Baghdasaryan
  2023-12-30  2:59 ` Suren Baghdasaryan
  0 siblings, 1 reply; 2+ messages in thread
From: Suren Baghdasaryan @ 2023-12-30  2:56 UTC (permalink / raw)
  To: akpm
  Cc: viro, brauner, shuah, aarcange, lokeshgidra, peterx, david,
	ryan.roberts, hughd, mhocko, axelrasmussen, rppt, willy,
	Liam.Howlett, jannh, zhangpeng362, bgeffon, kaleshsingh,
	ngeoffray, jdduke, surenb, linux-mm, linux-fsdevel, linux-kernel,
	linux-kselftest, kernel-team

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.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
Patch applies over mm-unstable.

 tools/testing/selftests/mm/uffd-unit-tests.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c
index d8091523c2df..cce90a10515a 100644
--- a/tools/testing/selftests/mm/uffd-unit-tests.c
+++ b/tools/testing/selftests/mm/uffd-unit-tests.c
@@ -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,
-- 
2.34.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-30  3:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-30  2:56 [PATCH 1/2] selftests/mm: add separate UFFDIO_MOVE test for PMD splitting Suren Baghdasaryan
2023-12-30  2:59 ` Suren Baghdasaryan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox