From: sashiko-bot@kernel.org
To: "SeongJae Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH] mm/damon/core: trace esz at first setup
Date: Wed, 20 May 2026 01:18:37 +0000 [thread overview]
Message-ID: <20260520011837.6192D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260520005940.92003-1-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The monotonic accumulators `total_charged_ns` and `total_charged_sz` will rapidly overflow on 32-bit architectures, breaking the throughput estimation logic.
--
commit 4cb83c3ed801305fa15e94548668201c275a1037
Author: SeongJae Park <sj@kernel.org>
mm/damon/core: trace esz at first setup
This commit fixes an issue where the initial effective size quota is not
traced, which leaves tracepoint investigations incomplete when using the
temporal tuner. It updates the quota adjustment logic to unconditionally
trace the initial quota value.
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 4e223857a0f99..0db6530825d1d 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -2883,6 +2883,8 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
> if (!quota->total_charged_sz && !quota->charged_from) {
[Severity: High]
This isn't a bug introduced by this patch, but will total_charged_ns and
total_charged_sz overflow on 32-bit architectures?
Since unsigned long is 32 bits on those systems, total_charged_ns will
overflow after roughly 4.29 seconds of total active execution time.
Additionally, the throughput calculation in damos_set_effective_quota():
damos_set_effective_quota() {
...
if (quota->total_charged_ns)
throughput = mult_frac(quota->total_charged_sz,
1000000, quota->total_charged_ns);
...
}
uses mult_frac() which evaluates (x % d) * n internally using the type of x.
Since the remainder could be up to total_charged_ns - 1, multiplying it by
1,000,000 will quickly overflow the 32-bit boundary. This produces incorrect
throughput estimates and impacts the effective size quota calculations on
32-bit systems.
> quota->charged_from = jiffies;
> damos_set_effective_quota(c, s);
> + if (trace_damos_esz_enabled())
> + damos_trace_esz(c, s, quota);
> }
>
> /* New charge window starts */
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260520005940.92003-1-sj@kernel.org?part=1
next prev parent reply other threads:[~2026-05-20 1:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 0:59 [RFC PATCH] mm/damon/core: trace esz at first setup SeongJae Park
2026-05-20 1:18 ` sashiko-bot [this message]
2026-05-20 1:28 ` SeongJae 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=20260520011837.6192D1F000E9@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