Skip to contentSkip to conversation

mm-damon-tests-core-kunit-add-a-test-for-damon_commit_ctx.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 29

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/tests/core-kunit: add a test for damon_commit_ctx()
has been removed from the -mm tree. Its filename was
mm-damon-tests-core-kunit-add-a-test-for-damon_commit_ctx.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: SeongJae Park <[email protected]>
Subject: mm/damon/tests/core-kunit: add a test for damon_commit_ctx()
Date: Sat, 7 Mar 2026 11:42:20 -0800

Patch series "mm/damon: test and document power-of-2 min_region_sz requirement".

Since commit c80f46ac228b ("mm/damon/core: disallow non-power of two min_region_sz"), min_region_sz is always restricted to be a power of two. Add a kunit test to confirm the functionality. Also, the change adds a restriction to addr_unit parameter. Clarify it on the document.

This patch (of 2):

Add a kunit test for confirming the change that is made on commit c80f46ac228b ("mm/damon/core: disallow non-power of two min_region_sz") functions as expected.

Cc Brendan Higgins <[email protected]>
Cc David Gow <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Liam Howlett <[email protected]>
Cc Lorenzo Stoakes (Oracle) <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc SeongJae Park <[email protected]>
Cc Suren Baghdasaryan <[email protected]>

---

 mm/damon/tests/core-kunit.h |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
mm/damon/tests/core-kunit.h renamed from mm/damon/tests/core-kunit.h~mm-damon-tests-core-kunit-add-a-test-for-damon_commit_ctx +22 -0
@@ -1057,6 +1057,27 @@ static void damon_test_commit_target_reg
 			(unsigned long[][2]) {{3, 8}, {8, 10}}, 2);
 }
 
+static void damon_test_commit_ctx(struct kunit *test)
+{
+	struct damon_ctx *src, *dst;
+
+	src = damon_new_ctx();
+	if (!src)
+		kunit_skip(test, "src alloc fail");
+	dst = damon_new_ctx();
+	if (!dst) {
+		damon_destroy_ctx(src);
+		kunit_skip(test, "dst alloc fail");
+	}
+	/* Only power of two min_region_sz is allowed. */
+	src->min_region_sz = 4096;
+	KUNIT_EXPECT_EQ(test, damon_commit_ctx(dst, src), 0);
+	src->min_region_sz = 4095;
+	KUNIT_EXPECT_EQ(test, damon_commit_ctx(dst, src), -EINVAL);
+	damon_destroy_ctx(src);
+	damon_destroy_ctx(dst);
+}
+
 static void damos_test_filter_out(struct kunit *test)
 {
 	struct damon_target *t;
@@ -1313,6 +1334,7 @@ static struct kunit_case damon_test_case
 	KUNIT_CASE(damos_test_commit_pageout),
 	KUNIT_CASE(damos_test_commit_migrate_hot),
 	KUNIT_CASE(damon_test_commit_target_regions),
+	KUNIT_CASE(damon_test_commit_ctx),
 	KUNIT_CASE(damos_test_filter_out),
 	KUNIT_CASE(damon_test_feed_loop_next_input),
 	KUNIT_CASE(damon_test_set_filters_default_reject),

_

Patches currently in -mm which might be from [email protected] are

mm-damon-sysfs-dealloc-repeat_call_control-if-damon_call-fails.patch