From: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
To: sj@kernel.org
Cc: damon@lists.linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
Subject: [PATCH] mm/damon/tests/core-kunit: add test for damon_call() on obsolete ctx
Date: Tue, 17 Nov 2026 22:52:19 +0530 [thread overview]
Message-ID: <20261117172219.26725-1-saileshnandanavanam@gmail.com> (raw)
A newly allocated damon_ctx has call_controls_obsolete set, meaning no
kdamond is available to handle call requests. damon_call() should
return -ECANCELED in that case instead of queueing the request and
waiting forever. Add a kunit test for that.
Signed-off-by: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
---
mm/damon/tests/core-kunit.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index 43e2f950f8ff..13315291f69f 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -2481,6 +2481,24 @@ static void damon_test_last_region_quota_reset(struct kunit *test)
damon_free_target(t);
}
+static void damon_test_call_controls_obsolete(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");
+
+ ret = damon_call(ctx, &control);
+
+ KUNIT_EXPECT_EQ(test, ret, -ECANCELED);
+
+ damon_destroy_ctx(ctx);
+}
+
static struct kunit_case damon_test_cases[] = {
KUNIT_CASE(damon_test_target),
KUNIT_CASE(damon_test_regions),
@@ -2525,6 +2543,7 @@ static struct kunit_case damon_test_cases[] = {
KUNIT_CASE(damon_test_rand),
KUNIT_CASE(damos_test_esz_goal_temporal),
KUNIT_CASE(damon_test_last_region_quota_reset),
+ KUNIT_CASE(damon_test_call_controls_obsolete),
{},
};
base-commit: 72e1cd73734bc4d52affbf7896389bf3814bcf9d
--
2.34.1
reply other threads:[~2026-11-17 17:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261117172219.26725-1-saileshnandanavanam@gmail.com \
--to=saileshnandanavanam@gmail.com \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®