From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH 6.18.y 1/2] mm/damon/core: allow esz to be set to zero
Date: Tue, 29 Sep 2026 17:59:16 +0000 [thread overview]
Message-ID: <20260929175917.6E5D71F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929174456.9251-1-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mm/damon: removing min_sz_region clamp on esz breaks quota accounting
--
commit f7906e90ad53cf62853b7b051dfd11b8012181f1
Author: Liew Rui Yan <aethernet65535@gmail.com>
Subject: mm/damon/core: allow esz to be set to zero
This patch modifies damos_set_effective_quota() to allow the effective
size quota (esz) to be reduced as much as possible when temporal quota
goals are achieved. It does this by removing the clamp against
min_sz_region when calculating esz.
Link: https://lore.kernel.org/20260908135413.97570-1-sj@kernel.org
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 6fa02025d2af1..facb1fa1f695f 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
[ ... ]
> @@ -2212,8 +2213,8 @@ static void damos_set_effective_quota(struct damos_quota *quota,
> quota->total_charged_ns);
> else
> throughput = PAGE_SIZE * 1024;
> - esz = min(throughput * quota->ms, esz);
> - esz = max(ctx->min_sz_region, esz);
> + esz_time = max(throughput * quota->ms, ctx->min_sz_region);
> + esz = min(esz_time, esz);
> }
[Severity: Medium]
Will this break quota accounting when goals are over-achieved?
By removing the clamp against min_sz_region, esz can drop below the minimum
region size, for example to 1.
If esz becomes 1, does ALIGN_DOWN() in damos_apply_scheme() evaluate to 0?
mm/damon/core.c:damos_apply_scheme() {
if (quota->esz && quota->charged_sz + sz > quota->esz) {
sz = ALIGN_DOWN(quota->esz - quota->charged_sz,
c->min_sz_region);
if (!sz)
goto update_stat;
damon_split_region_at(t, r, sz);
}
...
quota->charged_sz += sz;
}
If sz evaluates to 0, it jumps to update_stat and bypasses incrementing
quota->charged_sz.
Because quota->charged_sz gets frozen at 0, wouldn't this prevent the quota
short-circuit from ever being taken in damon_do_apply_schemes()?
mm/damon/core.c:damon_do_apply_schemes() {
/* Check the quota */
if (quota->esz && quota->charged_sz >= quota->esz)
continue;
}
Can this also corrupt the qt_exceeds statistic since the same check
fails in damos_adjust_quota()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260929174456.9251-1-sj@kernel.org?part=1
next prev parent reply other threads:[~2026-09-29 17:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 17:44 [PATCH 6.18.y 1/2] mm/damon/core: allow esz to be set to zero SJ Park
2026-09-29 17:44 ` [PATCH 6.18.y 2/2] mm/damon/core: fix unconditionally skip last region SJ Park
2026-09-29 17:55 ` sashiko-bot
2026-09-29 17:59 ` sashiko-bot [this message]
2026-09-29 19:13 ` [PATCH 6.18.y 1/2] mm/damon/core: allow esz to be set to zero SJ Park
2026-09-30 4:34 ` Greg KH
2026-09-30 8:09 ` SJ Park
2026-09-30 12:29 ` Greg KH
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=20260929175917.6E5D71F000FF@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