From: SeongJae Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SeongJae Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: [PATCH 6.18.y v2] mm/damon/core: disallow time-quota setting zero esz
Date: Thu, 7 May 2026 01:12:02 -0700 [thread overview]
Message-ID: <20260507081202.11547-1-sj@kernel.org> (raw)
In-Reply-To: <20260506204045.F0C53C2BCB0@smtp.kernel.org>
On Wed, 06 May 2026 20:40:45 +0000 sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Incomplete fix: DAMOS scheme can still unexpectedly deactivate if using quota goals without a time quota.
No valid issue. Read below for details, please.
> --
>
> commit ce7d104c8087fff14fb782b89848659312c204fa
> Author: SeongJae Park <sj@kernel.org>
> Subject: mm/damon/core: disallow time-quota setting zero esz
>
> This commit addresses an issue where DAMOS time quota can reduce the
> effective size quota below the minimum region size. This causes no actions
> to be applied, unexpectedly deactivating the scheme. The fix enforces a
> lower bound of min_sz_region on the effective size quota when a time quota
> is used.
>
> 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 87b6c9c2d6471..feec1b0c2babe 100644
> > --- a/mm/damon/core.c
> > +++ b/mm/damon/core.c
> [ ... ]
> > @@ -2150,6 +2151,7 @@ static void damos_set_effective_quota(struct damos_quota *quota)
> > else
> > throughput = PAGE_SIZE * 1024;
> > esz = min(throughput * quota->ms, esz);
> > + esz = max(ctx->min_sz_region, esz);
> > }
> >
> > if (quota->sz && quota->sz < esz)
>
> Could this still leave a case where the scheme is unexpectedly deactivated
> if quota goals are used without a time quota?
>
> If a scheme is configured with quota goals (!list_empty("a->goals)) but
> no time quota (quota->ms == 0), the bounds check added here inside the
> if (quota->ms) block is bypassed.
>
> When the system metric over-achieves, the feedback loop in
> damon_feed_loop_next_input() can limit quota->esz_bp to its minimum of
> 10000, which evaluates to an esz of 1:
>
> if (!list_empty("a->goals)) {
> unsigned long score = damos_quota_score(quota);
>
> quota->esz_bp = damon_feed_loop_next_input(
> max(quota->esz_bp, 10000UL),
> score);
> esz = quota->esz_bp / 10000;
> }
>
> During scheme application, damos_apply_scheme() calculates the size using
> ALIGN_DOWN(1 - 0, ctx->min_sz_region). Since min_sz_region is typically
> PAGE_SIZE, this evaluates to 0 and the action is skipped entirely.
>
> Because the feedback loop increases esz_bp multiplicatively, it would take
> multiple charge windows for esz to grow from 1 back to min_sz_region after
> the score drops. During this period, the scheme applies 0 actions despite
> the score indicating they are needed.
Yes, and this is the intended behavior.
>
> Should the max(ctx->min_sz_region, esz) bound be applied outside the
> if (quota->ms) block to ensure any auto-tuned esz is properly bounded?
Because it is an intended behavior, no.
Thanks,
SJ
[...]
prev parent reply other threads:[~2026-05-07 8:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-03 12:41 FAILED: patch "[PATCH] mm/damon/core: disallow time-quota setting zero esz" failed to apply to 6.18-stable tree gregkh
2026-05-04 13:01 ` [PATCH 6.18.y] mm/damon/core: disallow time-quota setting zero esz SeongJae Park
2026-05-04 17:06 ` sashiko-bot
2026-05-06 16:49 ` SeongJae Park
2026-05-06 16:52 ` [PATCH 6.18.y v2] " SeongJae Park
2026-05-06 20:40 ` sashiko-bot
2026-05-07 8:12 ` SeongJae 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=20260507081202.11547-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.