Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms
@ 2026-09-02  0:27 SJ Park
  2026-09-02  0:27 ` [PATCH 1/4] mm/damon/tests/core-kunit: test committing psi goal to psi goal SJ Park
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: SJ Park @ 2026-09-02  0:27 UTC (permalink / raw)
  To: Andrew Morton
  Cc: SJ Park, stable, Brendan Higgins, David Gow, Quanmin Yan,
	Ravi Jonnalagadda, damon, kunit-dev, linux-kernel,
	linux-kselftest, linux-mm

DAMOS quota goals commit unit test is mistakenly not testing a test case
that was designed to test.  DAMOS quota goals and DAMON sysfs refresh_ms
file have bugs that can produce non critical but still unexpected
behaviors.  Fix the bugs.

Patch 1 fixes the DAMOS quota goals commit unit test to cover a
mistakenly uncovered case.  Patches 2 and 3 fix the bugs in DAMOS PSI
goal initialization and eligible_mem_bp online commit, respectively.
Patch 4 fixes the bug in DAMON sysfs refresh_ms file handling.

Changes from RFC v1.3
- RFC v1.3: https://lore.kernel.org/20260828183649.71192-1-sj@kernel.org
- Drop RFC tag.
- Rebase to latest mm-new.
Changes from RFC v1.2
- RFC v1.2: https://lore.kernel.org/20260828014659.121058-1-sj@kernel.org
- Fix last_psi_total underflow.
Changes from RFC v1.1
- RFC v1.1: https://lore.kernel.org/20260827134429.123023-1-sj@kernel.org
- Fix quota goals commit unit test that was mistakenly missing a test case.
- Initialize last_psi_total as uninitialized at the beginning.
- Correct kunit test for changed last_psi_total initialization behavior.
Changes from RFC
- RFC: https://lore.kernel.org/20260827042920.93580-1-sj@kernel.org
  (Mistakenly missed RFC tag)
- Fix build error.
- Add eligible_mem_bp nid commit fix.

SJ Park (4):
  mm/damon/tests/core-kunit: test committing psi goal to psi goal
  mm/damon/core: handle uninitialized damos_quota_goal->last_psi_total
  mm/damon/core: copy nid for eligible_mem_bp damos quota goal commit
  mm/damon/sysfs: set next refresh jiffies per sysfs context

 mm/damon/core.c             | 16 ++++++++++++++--
 mm/damon/sysfs.c            | 11 +++++------
 mm/damon/tests/core-kunit.h | 16 ++++++++++------
 3 files changed, 29 insertions(+), 14 deletions(-)


base-commit: ee125db0b1f24a2f6b04e3143ffe1a14324176fe
-- 
2.47.3

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

* [PATCH 1/4] mm/damon/tests/core-kunit: test committing psi goal to psi goal
  2026-09-02  0:27 [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms SJ Park
@ 2026-09-02  0:27 ` SJ Park
  2026-09-03  8:33   ` Kunwu Chan
  2026-09-02  1:16 ` [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms SJ Park
  2026-09-03  3:13 ` Lian Wang
  2 siblings, 1 reply; 6+ messages in thread
From: SJ Park @ 2026-09-02  0:27 UTC (permalink / raw)
  To: Andrew Morton
  Cc: SJ Park, stable, Brendan Higgins, David Gow, damon, kunit-dev,
	linux-kernel, linux-kselftest, linux-mm

damon_test_commit_quota_goal_for() is set to test committing a new psi
goal on an existing psi goal.  However, damon_test_commit_quota_goal()
is mistakenly not covering the test case.  Add the test case.

Fixes: 99f89debafc5 ("mm/damon/tests/core-kunit: add damos_commit_quota_goal() test")
Cc: <stable@vger.kernel.org> # 6.19.x
Signed-off-by: SJ Park <sj@kernel.org>
---
 mm/damon/tests/core-kunit.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index 7071ec277b007..f1e11548c771b 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -793,6 +793,13 @@ static void damos_test_commit_quota_goal(struct kunit *test)
 		.last_psi_total = 456,
 	};
 
+	damos_test_commit_quota_goal_for(test, &dst,
+			&(struct damos_quota_goal) {
+			.metric = DAMOS_QUOTA_SOME_MEM_PSI_US,
+			.target_value = 234,
+			.current_value = 345,
+			.last_psi_total = 567,
+			});
 	damos_test_commit_quota_goal_for(test, &dst,
 			&(struct damos_quota_goal){
 			.metric = DAMOS_QUOTA_USER_INPUT,
-- 
2.47.3

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

* Re: [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms
  2026-09-02  0:27 [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms SJ Park
  2026-09-02  0:27 ` [PATCH 1/4] mm/damon/tests/core-kunit: test committing psi goal to psi goal SJ Park
@ 2026-09-02  1:16 ` SJ Park
  2026-09-03  3:13 ` Lian Wang
  2 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-02  1:16 UTC (permalink / raw)
  To: SJ Park
  Cc: Andrew Morton, stable, Brendan Higgins, David Gow, Quanmin Yan,
	Ravi Jonnalagadda, damon, kunit-dev, linux-kernel,
	linux-kselftest, linux-mm

On Tue,  1 Sep 2026 17:27:19 -0700 SJ Park <sj@kernel.org> wrote:

> DAMOS quota goals commit unit test is mistakenly not testing a test case
> that was designed to test.  DAMOS quota goals and DAMON sysfs refresh_ms
> file have bugs that can produce non critical but still unexpected
> behaviors.  Fix the bugs.

Sashiko found no blocker for this series.  Sashiko sent findings to damon@
mailing list [1], and I replied to all the comments.  Please read those for
details.

Sashiko found a typo in the commit message of patch 3, though.  It should
's/QUITA/QUOTA/'.  I asked Andrew if he could fix it from his side.

[1] https://lore.kernel.org/damon/


Thanks,
SJ

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

* Re: [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms
  2026-09-02  0:27 [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms SJ Park
  2026-09-02  0:27 ` [PATCH 1/4] mm/damon/tests/core-kunit: test committing psi goal to psi goal SJ Park
  2026-09-02  1:16 ` [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms SJ Park
@ 2026-09-03  3:13 ` Lian Wang
  2026-09-03 13:51   ` SJ Park
  2 siblings, 1 reply; 6+ messages in thread
From: Lian Wang @ 2026-09-03  3:13 UTC (permalink / raw)
  To: SJ Park
  Cc: Andrew Morton, stable, Brendan Higgins, David Gow, Quanmin Yan,
	Ravi Jonnalagadda, damon, kunit-dev, linux-kernel,
	linux-kselftest, linux-mm

Hi SJ,

> Patch 1 fixes the DAMOS quota goals commit unit test to cover a
> mistakenly uncovered case.  Patches 2 and 3 fix the bugs in DAMOS PSI
> goal initialization and eligible_mem_bp online commit, respectively.
> Patch 4 fixes the bug in DAMON sysfs refresh_ms file handling.

I reviewed and tested the integrated four-patch series in mm-new:

  a20e38846efb..72dc8fdaae62

The integrated commits had stable patch-ids matching the posted patches.
DAMON KUnit passed 42/42 tests.  I also ran test-only eligible_mem_bp nid and
two-kdamond refresh-isolation regression cases; they passed 42/42 and 43/43
tests, respectively.  Both test-only changes were then removed and the
worktree returned clean at the unchanged series tip.

These were functional UML KUnit tests.  The fixes look good to me.

For the series:

Reviewed-by: Lian Wang <lianux.mm@gmail.com>
Tested-by: Lian Wang <lianux.mm@gmail.com>

Thanks,
Lian

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

* Re: [PATCH 1/4] mm/damon/tests/core-kunit: test committing psi goal to psi goal
  2026-09-02  0:27 ` [PATCH 1/4] mm/damon/tests/core-kunit: test committing psi goal to psi goal SJ Park
@ 2026-09-03  8:33   ` Kunwu Chan
  0 siblings, 0 replies; 6+ messages in thread
From: Kunwu Chan @ 2026-09-03  8:33 UTC (permalink / raw)
  To: SJ Park
  Cc: Kunwu Chan, Andrew Morton, stable, Brendan Higgins, David Gow,
	damon, kunit-dev, linux-kernel, linux-kselftest, linux-mm,
	Kunwu Chan

On Tue,  1 Sep 2026 17:27:20 -0700 SJ Park <sj@kernel.org> wrote:

> damon_test_commit_quota_goal_for() is set to test committing a new psi
> goal on an existing psi goal.  However, damon_test_commit_quota_goal()
> is mistakenly not covering the test case.  Add the test case.
> 
> Fixes: 99f89debafc5 ("mm/damon/tests/core-kunit: add damos_commit_quota_goal() test")
> Cc: <stable@vger.kernel.org> # 6.19.x
> Signed-off-by: SJ Park <sj@kernel.org>
> ---
>  mm/damon/tests/core-kunit.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
> index 7071ec277b007..f1e11548c771b 100644
> --- a/mm/damon/tests/core-kunit.h
> +++ b/mm/damon/tests/core-kunit.h
> @@ -793,6 +793,13 @@ static void damos_test_commit_quota_goal(struct kunit *test)
>  		.last_psi_total = 456,
>  	};
>  
> +	damos_test_commit_quota_goal_for(test, &dst,
> +			&(struct damos_quota_goal) {
> +			.metric = DAMOS_QUOTA_SOME_MEM_PSI_US,
> +			.target_value = 234,
> +			.current_value = 345,
> +			.last_psi_total = 567,
> +			});
>  	damos_test_commit_quota_goal_for(test, &dst,
>  			&(struct damos_quota_goal){
>  			.metric = DAMOS_QUOTA_USER_INPUT,
> -- 
> 2.47.3
> 

Thanks SJ. The added case correctly exercises the PSI -> PSI commit 
path before the existing tests change the destination metric.

Reviewed-by: Kunwu Chan <kunwu.chan@gmail.com>

Thanks,
Kunwu


Sent using hkml (https://github.com/sjp38/hackermail)

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

* Re: [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms
  2026-09-03  3:13 ` Lian Wang
@ 2026-09-03 13:51   ` SJ Park
  0 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-03 13:51 UTC (permalink / raw)
  To: Lian Wang
  Cc: SJ Park, Andrew Morton, stable, Brendan Higgins, David Gow,
	Quanmin Yan, Ravi Jonnalagadda, damon, kunit-dev, linux-kernel,
	linux-kselftest, linux-mm

On Thu,  3 Sep 2026 11:13:28 +0800 Lian Wang <lianux.mm@gmail.com> wrote:

> Hi SJ,
> 
> > Patch 1 fixes the DAMOS quota goals commit unit test to cover a
> > mistakenly uncovered case.  Patches 2 and 3 fix the bugs in DAMOS PSI
> > goal initialization and eligible_mem_bp online commit, respectively.
> > Patch 4 fixes the bug in DAMON sysfs refresh_ms file handling.
> 
> I reviewed and tested the integrated four-patch series in mm-new:
> 
>   a20e38846efb..72dc8fdaae62
> 
> The integrated commits had stable patch-ids matching the posted patches.
> DAMON KUnit passed 42/42 tests.  I also ran test-only eligible_mem_bp nid and
> two-kdamond refresh-isolation regression cases; they passed 42/42 and 43/43
> tests, respectively.  Both test-only changes were then removed and the
> worktree returned clean at the unchanged series tip.
> 
> These were functional UML KUnit tests.  The fixes look good to me.
> 
> For the series:
> 
> Reviewed-by: Lian Wang <lianux.mm@gmail.com>
> Tested-by: Lian Wang <lianux.mm@gmail.com>

Thank you for your review and test, Lian!


Thanks,
SJ

[...]

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

end of thread, other threads:[~2026-09-03 13:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02  0:27 [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms SJ Park
2026-09-02  0:27 ` [PATCH 1/4] mm/damon/tests/core-kunit: test committing psi goal to psi goal SJ Park
2026-09-03  8:33   ` Kunwu Chan
2026-09-02  1:16 ` [PATCH 0/4] mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms SJ Park
2026-09-03  3:13 ` Lian Wang
2026-09-03 13:51   ` SJ Park

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