From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH v1.1 1/3] mm/damon/core: initialize damos_quota_goal->last_psi_total
Date: Thu, 27 Aug 2026 13:59:58 +0000 [thread overview]
Message-ID: <20260827135958.940FB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827134429.123023-2-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Unconditionally resetting last_psi_total in damos_commit_quota_goal_union() breaks the feedback loop measurement interval for existing goals during sysfs updates.
- [Medium] The patch changes the semantics of damos_commit_quota_goal() to explicitly overwrite last_psi_total instead of preserving it, but leaves behind a KUnit test assertion that expects preservation.
--
commit 8007d7351717974f3d1ef45ed438346542307389
Author: SJ Park <sj@kernel.org>
mm/damon/core: initialize damos_quota_goal->last_psi_total
This patch initializes the last_psi_total for DAMOS_QUOTA_SOME_MEM_PSI_US
quota goals to prevent the first iteration of the feedback loop from using
an uninitialized value. It introduces initialization at the start of kdamond
and during each goal commit.
Link: https://lore.kernel.org/20260718005316.89585-1-sj@kernel.org
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 644daf5a16560..723ab998b63c7 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -1118,10 +1118,15 @@ static struct damos_quota_goal *damos_nth_quota_goal(
> return NULL;
> }
>
> +static u64 damos_get_some_mem_psi_total(void);
> +
> static void damos_commit_quota_goal_union(
> struct damos_quota_goal *dst, struct damos_quota_goal *src)
> {
> switch (dst->metric) {
> + case DAMOS_QUOTA_SOME_MEM_PSI_US:
> + dst->last_psi_total = damos_get_some_mem_psi_total();
> + break;
[Severity: High]
Does this unconditional reset of last_psi_total truncate the measurement
window for running goals that are updated via sysfs?
When a user updates a running DAMON context via sysfs that includes an
existing DAMOS_QUOTA_SOME_MEM_PSI_US goal, this overwrites the running
goal's last_psi_total with the current time's PSI value, without resetting
the overall charged_from interval timer.
Could this produce an artificially small current_value, causing the feedback
loop tuner to falsely assume memory pressure is low and erroneously increase
the scheme's quota?
> case DAMOS_QUOTA_NODE_MEM_USED_BP:
> case DAMOS_QUOTA_NODE_MEM_FREE_BP:
> dst->nid = src->nid;
[ ... ]
> @@ -1143,7 +1148,6 @@ static void damos_commit_quota_goal(
> dst->target_value = src->target_value;
> if (dst->metric == DAMOS_QUOTA_USER_INPUT)
> dst->current_value = src->current_value;
> - /* keep last_psi_total as is, since it will be updated in next cycle */
> damos_commit_quota_goal_union(dst, src);
> }
[Severity: Medium]
Since the semantics of damos_commit_quota_goal() have changed to explicitly
overwrite last_psi_total rather than preserve it, should the corresponding
KUnit test be updated as well?
The existing KUnit test in mm/damon/tests/core-kunit.h
(damos_test_commit_quota_goal_for()) expects the old preservation behavior:
if (dst_last_psi_total && src->metric == DAMOS_QUOTA_SOME_MEM_PSI_US)
KUNIT_EXPECT_EQ(test, dst->last_psi_total, dst_last_psi_total);
Without updating this assertion, there appears to be a mismatch between the
new code behavior and what the test expects.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260827134429.123023-1-sj@kernel.org?part=1
next prev parent reply other threads:[~2026-08-27 14:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 13:44 [RFC PATCH v1.1 0/3] mm/damon: fix wrong behaviors in DAMOS quota goals and sysfs refresh_ms SJ Park
2026-08-27 13:44 ` [RFC PATCH v1.1 1/3] mm/damon/core: initialize damos_quota_goal->last_psi_total SJ Park
2026-08-27 13:59 ` sashiko-bot [this message]
2026-08-27 14:17 ` SJ Park
2026-08-27 14:50 ` SJ Park
2026-08-27 15:19 ` SJ Park
2026-08-27 13:44 ` [RFC PATCH v1.1 2/3] mm/damon/core: copy nid for eligible_mem_bp damos quota goal commit SJ Park
2026-08-27 13:53 ` sashiko-bot
2026-08-27 13:44 ` [RFC PATCH v1.1 3/3] mm/damon/sysfs: set next refresh jiffies per sysfs context SJ Park
2026-08-27 13:52 ` sashiko-bot
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=20260827135958.940FB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--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;
as well as URLs for NNTP newsgroup(s).