From: sashiko-bot@kernel.org
To: "SeongJae Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH 6.6.y] mm/damon/core: disallow time-quota setting zero esz
Date: Mon, 04 May 2026 14:26:22 +0000 [thread overview]
Message-ID: <20260504142622.B36A0C2BCC4@smtp.kernel.org> (raw)
In-Reply-To: <20260504125529.18220-1-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Integer overflow in throughput estimation permanently breaks DAMOS time quota mechanism.
--
commit 352051c643d14056b79b910e005f54b4d071e250
Author: SeongJae Park <sj@kernel.org>
mm/damon/core: disallow time-quota setting zero esz
This patch fixes an issue where a slow DAMOS scheme causes the effective size
quota to fall below the minimum region size, which prevents actions from being
applied. Because no actions are applied, the charge statistics stop updating
and the scheme is unexpectedly deactivated. The fix ensures the effective size
quota is always clamped to at least the minimum region size.
Link: https://lore.kernel.org/20260407003153.79589-1-sj@kernel.org
Link: https://lore.kernel.org/20260405192504.110014-1-sj@kernel.org [1]
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 48747236c21c..12c2e584659a 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -1026,6 +1026,7 @@ static void damos_set_effective_quota(struct damos_quota *quota)
> else
> throughput = PAGE_SIZE * 1024;
> esz = throughput * quota->ms;
Since total_charged_sz accumulates lifetime processed bytes without being
reset, can the throughput calculation that precedes this line cause a
regression by overflowing?
In damos_set_effective_quota(), throughput is calculated as:
throughput = quota->total_charged_sz * 1000000 / quota->total_charged_ns;
On 32-bit architectures, total_charged_sz * 1000000 would overflow when
total_charged_sz reaches just 4295 bytes. On 64-bit architectures, it would
overflow after about 18.44 TB of memory processed.
Once total_charged_sz * 1000000 wraps around, the numerator becomes extremely
small compared to the denominator (which on 64-bit takes 584 years to wrap),
causing the computed throughput to instantly drop to near zero.
> + esz = max(DAMON_MIN_REGION, esz);
Although this clamping ensures esz never drops below DAMON_MIN_REGION, would
the scheme become permanently throttled down to this minimum region size
until the numerator catches up again after another 18 TB of processing?
>
> if (quota->sz && quota->sz < esz)
> esz = quota->sz;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260504125529.18220-1-sj@kernel.org?part=1
next prev parent reply other threads:[~2026-05-04 14:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2026050319-verbally-voltage-207f@gregkh>
2026-05-04 12:55 ` [PATCH 6.6.y] mm/damon/core: disallow time-quota setting zero esz SeongJae Park
2026-05-04 14:26 ` sashiko-bot [this message]
2026-05-06 17:04 ` 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=20260504142622.B36A0C2BCC4@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko@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