DAMON development mailing list
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SJ Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: [PATCH 1/2] mm/damon/core: initialize damos_quota_goal->last_psi_total
Date: Wed, 26 Aug 2026 21:50:34 -0700	[thread overview]
Message-ID: <20260827045035.94611-1-sj@kernel.org> (raw)
In-Reply-To: <20260827044548.65E8B1F000E9@smtp.kernel.org>

On Thu, 27 Aug 2026 04:45:47 +0000 sashiko-bot@kernel.org wrote:

> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> 
> New issues:
> - [Low] Implicit declaration of function 'damos_get_some_mem_psi_total' causes a compilation error.
> 
> Pre-existing issues:
> - [High] The DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP metric's 'nid' field is not copied when committing a quota goal parameter update, leading to an uninitialized node ID being used for eligible memory queries.
> --
> 
> commit 9597a197ecbd4f36e4fa8dfa9bd1bdbb5a5f1d93
> Author: SJ Park <sj@kernel.org>
> 
> mm/damon/core: initialize damos_quota_goal->last_psi_total
> 
> Initializes the last_psi_total field at the beginning of kdamond and during
> each commit for SOME_MEM_PSI_US type quota goals. This prevents unexpected
> adjustments during the first iteration of the feedback loop.
> 
> 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..6f360d61390ad 100644
> > --- a/mm/damon/core.c
> > +++ b/mm/damon/core.c
> > @@ -1122,6 +1122,9 @@ 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();
> 
> [Severity: Low]
> Does this cause a compilation error due to an implicit function declaration?
> 
> The function damos_get_some_mem_psi_total() is called here, but it appears
> to be defined later in mm/damon/core.c without a prior forward declaration.

Good catch.  I will add the declaration in the next version.

> 
> > +		break;
> >  	case DAMOS_QUOTA_NODE_MEM_USED_BP:
> >  	case DAMOS_QUOTA_NODE_MEM_FREE_BP:
> >  		dst->nid = src->nid;
> 
> [Severity: High]
> This is a pre-existing issue, but does this switch statement omit the
> DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP metric?
> 
> When a user configures a DAMOS quota goal using the
> DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP metric via sysfs, a new quota goal is
> allocated in damos_new_quota_goal() via kmalloc_obj(), where the memory is
> not zeroed. 
> 
> Because DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP is missing from the switch statement
> in damos_commit_quota_goal_union(), its nid field is not copied over during
> parameter updates. This leaves the node ID uninitialized and potentially
> causes eligible memory queries to evaluate using garbage data, completely
> breaking the metric's functionality.

Good catch.  I will separately work on this.

> 
> [ ... ]
> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260827042920.93580-1-sj@kernel.org?part=1


Thanks,
SJ

  reply	other threads:[~2026-08-27  4:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27  4:29 [PATCH 0/2] mm/damon: fix wrong behaviors in DAMOS PSI goal and sysfs refresh_ms SJ Park
2026-08-27  4:29 ` [PATCH 1/2] mm/damon/core: initialize damos_quota_goal->last_psi_total SJ Park
2026-08-27  4:45   ` sashiko-bot
2026-08-27  4:50     ` SJ Park [this message]
2026-08-27  5:20       ` SJ Park
2026-08-27  4:29 ` [PATCH 2/2] mm/damon/sysfs: set next refresh jiffies per sysfs context SJ Park
2026-08-27  4:35   ` sashiko-bot
2026-08-27  4:42 ` [PATCH 0/2] mm/damon: fix wrong behaviors in DAMOS PSI goal and sysfs refresh_ms SJ Park

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=20260827045035.94611-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=sashiko-bot@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