From: SJ Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SJ Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: [RFC PATCH v5 8/8] Docs/ABI/damon: update for quota goal metric complement sysfs file
Date: Mon, 28 Sep 2026 02:49:20 -0700 [thread overview]
Message-ID: <20260928094922.17266-1-sj@kernel.org> (raw)
In-Reply-To: <20260928094400.5B0DF1F000FF@smtp.kernel.org>
On Mon, 28 Sep 2026 09:43:59 +0000 sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] mm: integer overflow in damos_set_psi_current_val() on 32-bit
> --
>
> commit 5d7327c0afcb5fe144677a675b1eea685917f61e
> Author: SJ Park <sj@kernel.org>
> Docs/ABI/damon: update for quota goal metric complement sysfs file
>
> This commit introduces a complement flag for the quota auto-tuning goal metric
> and updates the sysfs ABI documentation to reflect this addition. It also
> modifies the core DAMON tuning logic to support the complement calculation.
>
> > diff --git a/mm/damon/core.c b/mm/damon/core.c
> > index 733025b367457..86f13411b91fa 100644
> > --- a/mm/damon/core.c
> > +++ b/mm/damon/core.c
>
> [ ... ]
>
> > @@ -2960,10 +2962,18 @@ static void damos_set_psi_current_val(u64 now_psi_total,
> > struct damos_quota_goal *goal, struct damos *s)
> > {
> > u64 last_psi_total = goal->last_psi_total;
> > + unsigned long val;
> >
> > goal->last_psi_total = now_psi_total;
> > if (last_psi_total != U64_MAX) {
> > - goal->current_value = now_psi_total - last_psi_total;
> > + val = now_psi_total - last_psi_total;
> > + if (goal->complement) {
> > + if (val < s->quota.reset_interval * 1000)
> > + val = s->quota.reset_interval * 1000 - val;
>
> [Severity: Medium]
> Could this multiplication in mm/damon/core.c:damos_set_psi_current_val()
> overflow on 32-bit systems? If reset_interval is configured to a value
> greater than 4,294,967 (about 71 minutes) via sysfs,
> s->quota.reset_interval * 1000 will exceed the maximum value of a 32-bit
> unsigned long.
>
> This could cause the complement calculation to yield corrupted values or
> premature zeros, breaking the auto-tuning logic.
It is an extreme setup. Also, sane users would test it before using the new
feature. No blocker of this series in my opinion.
>
> > + else
> > + val = 0;
> > + }
> > + goal->current_value = val;
> > return;
> > }
> > /* uninitialized last_psi_total; make no effect this round */
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260928093342.16584-1-sj@kernel.org?part=8
>
Thanks,
SJ
prev parent reply other threads:[~2026-09-28 9:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 9:33 [RFC PATCH v5 0/8] mm/damon: introduce damos quota goal target metric complement flag SJ Park
2026-09-28 9:33 ` [RFC PATCH v5 1/8] mm/damon/core: introduce damos_quota_goal->complement SJ Park
2026-09-28 9:44 ` sashiko-bot
2026-09-28 9:47 ` SJ Park
2026-09-28 9:33 ` [RFC PATCH v5 2/8] mm/damon/core: add complement argument to damos_new_quota_goal() SJ Park
2026-09-28 9:42 ` sashiko-bot
2026-09-28 9:33 ` [RFC PATCH v5 3/8] mm/damon/sysfs-schemes: support quota goal complement flag SJ Park
2026-09-28 9:40 ` sashiko-bot
2026-09-28 9:33 ` [RFC PATCH v5 4/8] mm/damon/tests/core-kunit: test quota_goal->complement commit SJ Park
2026-09-28 9:37 ` sashiko-bot
2026-09-28 9:33 ` [RFC PATCH v5 5/8] selftests/damon/sysfs.sh: test quota goal complement flag file SJ Park
2026-09-28 9:36 ` sashiko-bot
2026-09-28 9:33 ` [RFC PATCH v5 6/8] Docs/mm/damon/design: document damos quota goal complement flag SJ Park
2026-09-28 9:39 ` sashiko-bot
2026-09-28 9:33 ` [RFC PATCH v5 7/8] Docs/admin-guide/mm/damon/usage: update for quota goal complement file SJ Park
2026-09-28 9:38 ` sashiko-bot
2026-09-28 9:33 ` [RFC PATCH v5 8/8] Docs/ABI/damon: update for quota goal metric complement sysfs file SJ Park
2026-09-28 9:43 ` sashiko-bot
2026-09-28 9:49 ` SJ Park [this message]
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=20260928094922.17266-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.