mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] mm/damon/tests/core-kunit: add test for damon_call()
@ 2026-11-18  6:37 Sailesh Nandanavanam
  2026-11-18 10:30 ` Aveline Noir
  2026-11-18 14:28 ` SJ Park
  0 siblings, 2 replies; 3+ messages in thread
From: Sailesh Nandanavanam @ 2026-11-18  6:37 UTC (permalink / raw)
  To: sj; +Cc: damon, linux-mm, linux-kernel, Sailesh Nandanavanam

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.  When call_controls_obsolete is unset and
damon_call_control->repeat is set, damon_call() should return 0
without waiting for kdamond.  Add a kunit test for the two cases.

Signed-off-by: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
---
Changes from v1
(https://lore.kernel.org/20261117172219.26725-1-saileshnandanavanam@gmail.com,
 https://lore.kernel.org/20261117174834.29182-1-saileshnandanavanam@gmail.com)
- Merge the two tests into damon_test_call().
- Drop the list_empty()/call_controls.next expectations.
- Drop list_del() on the stack-allocated control.
- Post as a single patch.

 mm/damon/tests/core-kunit.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index 43e2f950f8ff..228cb044d1dd 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -2481,6 +2481,27 @@ static void damon_test_last_region_quota_reset(struct kunit *test)
 	damon_free_target(t);
 }
 
+static void damon_test_call(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);
+
+	ctx->call_controls_obsolete = false;
+	control.repeat = true;
+	ret = damon_call(ctx, &control);
+	KUNIT_EXPECT_EQ(test, ret, 0);
+
+	damon_destroy_ctx(ctx);
+}
+
 static struct kunit_case damon_test_cases[] = {
 	KUNIT_CASE(damon_test_target),
 	KUNIT_CASE(damon_test_regions),
@@ -2525,6 +2546,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),
 	{},
 };
 

base-commit: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca
-- 
2.34.1


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

* Re: [PATCH v2] mm/damon/tests/core-kunit: add test for damon_call()
  2026-11-18  6:37 [PATCH v2] mm/damon/tests/core-kunit: add test for damon_call() Sailesh Nandanavanam
@ 2026-11-18 10:30 ` Aveline Noir
  2026-11-18 14:28 ` SJ Park
  1 sibling, 0 replies; 3+ messages in thread
From: Aveline Noir @ 2026-11-18 10:30 UTC (permalink / raw)
  To: Sailesh Nandanavanam
  Cc: damon, linux-kernel, linux-mm, sashiko-bot, sashiko-reviews, sj

Hi Sailesh,

On Wed, 18 Nov 2026 12:07:55 +0530 Sailesh Nandanavanam wrote:

> Add a kunit test for the two cases.

Make sense. Thanks :)

Tested v2 on x86-64 QEMU with v7.4-rc3 as the base. All DAMON KUnit
tests passed.

Tested-by: Aveline Noir <jm5905938@gmail.com>
Reviewed-by: Aveline Noir <jm5905938@gmail.com>

Thanks,
Aveline Noir

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

* Re: [PATCH v2] mm/damon/tests/core-kunit: add test for damon_call()
  2026-11-18  6:37 [PATCH v2] mm/damon/tests/core-kunit: add test for damon_call() Sailesh Nandanavanam
  2026-11-18 10:30 ` Aveline Noir
@ 2026-11-18 14:28 ` SJ Park
  1 sibling, 0 replies; 3+ messages in thread
From: SJ Park @ 2026-11-18 14:28 UTC (permalink / raw)
  To: Sailesh Nandanavanam; +Cc: SJ Park, damon, linux-mm, linux-kernel

Hello Sailesh,

On Wed, 18 Nov 2026 12:07:55 +0530 Sailesh Nandanavanam <saileshnandanavanam@gmail.com> wrote:

> 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.  When call_controls_obsolete is unset and
> damon_call_control->repeat is set, damon_call() should return 0
> without waiting for kdamond.  Add a kunit test for the two cases.
> 
> Signed-off-by: Sailesh Nandanavanam <saileshnandanavanam@gmail.com>
> ---
> Changes from v1
> (https://lore.kernel.org/20261117172219.26725-1-saileshnandanavanam@gmail.com,
>  https://lore.kernel.org/20261117174834.29182-1-saileshnandanavanam@gmail.com)
> - Merge the two tests into damon_test_call().
> - Drop the list_empty()/call_controls.next expectations.
> - Drop list_del() on the stack-allocated control.
> - Post as a single patch.

From the next time, please ensure all discussions on the previous version is
done.  You could do so by giving more time before posting a new version, since
the last message to the previous version thread is added.

[...]
> base-commit: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca

Seems this is the mainline.  Please use mm-new [1] as the baseline of DAMON
patches from the next time.

Other than those,

Reviewed-by: SJ Park <sj@kernel.org>

This patch is applied to damon/next [1] tree.  I will repost it soon (~1 week)
as an mm.git merge request.  So, no action from your side is needed for now.

[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees


Thanks,
SJ

[...]

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

end of thread, other threads:[~2026-11-18 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18  6:37 [PATCH v2] mm/damon/tests/core-kunit: add test for damon_call() Sailesh Nandanavanam
2026-11-18 10:30 ` Aveline Noir
2026-11-18 14:28 ` SJ Park

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®