mm/damon/tests/core-kunit: add test for damon_call() on obsolete ctx
Subsystems (2)
PATCH 1/1 mm/damon/tests/core-kunit: add test for damon_call() on obsolete ctx
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.
--- mm/damon/tests/core-kunit.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
mm/damon/tests/core-kunit.h +19 -0
@@ -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
Signature · 1 line
2.34.1
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 6 lines
A newly allocated
damon_ctxhascall_controls_obsoleteset, meaning no kdamond is available to handle call requests.damon_call()should return-ECANCELEDin that case instead of queueing the request and waiting forever. Add a kunit test for that.Signed-off-by Sailesh Nandanavanam <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
SJ Park
maintainerQuoted 4 lines · On Tue, 17 Nov 2026 22:52:19 +0530 Sailesh Nandanavanam…
A newly allocated
damon_ctxhascall_controls_obsoleteset, meaning no kdamond is available to handle call requests.damon_call()should return-ECANCELEDin that case instead of queueing the request and waiting forever. Add a kunit test for that.
Please check my suggestions on the reply [1] to your another patch.
[1] https://lore.kernel.org/[email protected]
Thanks,
SJ
[...]