From: SJ Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SJ Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: [PATCH] mm/damon/core: reset invalid quota->charge_target_from
Date: Mon, 7 Sep 2026 10:27:33 -0700 [thread overview]
Message-ID: <20260907172735.102248-1-sj@kernel.org> (raw)
In-Reply-To: <20260907171346.9A93F1F00A3A@smtp.kernel.org>
On Mon, 07 Sep 2026 17:13:46 +0000 sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
>
> Pre-existing issues:
> - [High] The newly added fix for invalid `charge_target_from` pointers is bypassed if a scheme's quota is dynamically disabled, leaving the scheme permanently broken.
> --
>
> commit f88287bb2670346a5987d086e0731c7ba6d0b19e
> Author: SJ Park <sj@kernel.org>
>
> mm/damon/core: reset invalid quota->charge_target_from
>
> DAMOS can suddenly stop working if a target process that quota just
> fully charged in it is terminated. Fix by catching and processing the
> corner case.
>
> > diff --git a/mm/damon/core.c b/mm/damon/core.c
> > index ce8c6f99106ed..2c58be9edbde4 100644
> > --- a/mm/damon/core.c
> > +++ b/mm/damon/core.c
> [ ... ]
> > @@ -3318,6 +3334,8 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
> > damos_trace_esz(c, s, quota);
> > }
> >
> > + damos_reset_invalid_charge_target_from(quota, c);
> > +
> > if (!c->ops.get_scheme_score)
> > return;
> >
>
> [Severity: High]
> This is a pre-existing issue, but does this bypass the newly added reset if a
> scheme's quota is dynamically disabled?
>
> If a user hits the corner case where charge_target_from becomes invalid, and
> then dynamically disables the scheme's quota via sysfs (setting ms=0 and
> sz=0), damos_adjust_quota() will return early before the reset is reached:
>
> mm/damon/core.c:damos_adjust_quota() {
> if (!quota->ms && !quota->sz && list_empty("a->goals))
> return;
> ...
> }
>
> Because damos_skip_charged_region() does not check if the quota is enabled
> before evaluating charge_target_from, it will continue to skip all regions
> forever:
>
> mm/damon/core.c:damos_skip_charged_region() {
> ...
> if (t != quota->charge_target_from)
> return true;
> ...
> }
>
> Could the pointer reset be moved before the early return in
> damos_adjust_quota(), or could the skipping logic be updated to handle
> disabled quotas?
Good catch. I think we should unset the charge_{target,addr}_from in
damos_commit_quota(). I will do so in the next version.
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260907165529.98874-1-sj@kernel.org?part=1
Thanks,
SJ
next prev parent reply other threads:[~2026-09-07 17:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 16:55 [PATCH] mm/damon/core: reset invalid quota->charge_target_from SJ Park
2026-09-07 17:13 ` sashiko-bot
2026-09-07 17:27 ` SJ Park [this message]
2026-09-07 17:28 ` 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=20260907172735.102248-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.