mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2] mm/damon/tests/core-kunit: add test for damon_call() with repeat control
@ 2026-11-17 17:48 Sailesh Nandanavanam
  0 siblings, 0 replies; only message in thread
From: Sailesh Nandanavanam @ 2026-11-17 17:48 UTC (permalink / raw)
  To: sj; +Cc: damon, linux-mm, linux-kernel, Sailesh Nandanavanam

When call_controls_obsolete is unset and damon_call_control->repeat is
set, damon_call() should queue the request and return 0 immediately
without waiting for kdamond to handle it.  Add a kunit test for that.

Signed-off-by: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
---
 mm/damon/tests/core-kunit.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index 13315291f69f..bc93677487b5 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -2499,6 +2499,30 @@ static void damon_test_call_controls_obsolete(struct kunit *test)
 	damon_destroy_ctx(ctx);
 }
 
+static void damon_test_call_repeat(struct kunit *test)
+{
+	struct damon_ctx *ctx;
+	struct damon_call_control control = {};
+	int ret;
+
+	ctx = damon_new_ctx();
+
+	if (!ctx)
+		kunit_skip(test, "ctx alloc fail");
+
+	ctx->call_controls_obsolete = false;
+	control.repeat = true;
+
+	ret = damon_call(ctx, &control);
+
+	KUNIT_EXPECT_EQ(test, ret, 0);
+	KUNIT_EXPECT_FALSE(test, list_empty(&ctx->call_controls));
+	KUNIT_EXPECT_PTR_EQ(test, ctx->call_controls.next, &control.list);
+
+	list_del(&control.list);
+	damon_destroy_ctx(ctx);
+}
+
 static struct kunit_case damon_test_cases[] = {
 	KUNIT_CASE(damon_test_target),
 	KUNIT_CASE(damon_test_regions),
@@ -2544,6 +2568,7 @@ static struct kunit_case damon_test_cases[] = {
 	KUNIT_CASE(damos_test_esz_goal_temporal),
 	KUNIT_CASE(damon_test_last_region_quota_reset),
 	KUNIT_CASE(damon_test_call_controls_obsolete),
+	KUNIT_CASE(damon_test_call_repeat),
 	{},
 };
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-17 17:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 17:48 [PATCH 2/2] mm/damon/tests/core-kunit: add test for damon_call() with repeat control Sailesh Nandanavanam

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

all inboxes | Powered by JetHome®