From: sashiko-bot@kernel.org
To: "Liew Rui Yan" <aethernet65535@gmail.com>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH v2] mm/damon/core: fix false positive in
Date: Wed, 02 Sep 2026 08:29:30 +0000 [thread overview]
Message-ID: <20260902082931.4536F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902081825.18931-1-aethernet65535@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The newly added early exit `if (!quota->esz)` in `damon_do_apply_schemes()` unintentionally skips and completely breaks all DAMOS schemes that do not have quotas configured.
- [Medium] The new condition `if (!quota->charged_sz)` in `damos_quota_is_full()` incorrectly skips quota exhaustion checks when a configured quota is smaller than `min_region_sz`, violating per-region quota semantics and leading to statistic inflation and wasted CPU cycles.
--
commit b189466ffcadd150b11edbb63a99f1fb0477b8b5
Author: Liew Rui Yan <aethernet65535@gmail.com>
mm/damon/core: fix false positive in
This commit aims to fix a false positive in damos_quota_is_full() when
goal_tuner is 'temporal' and the goal is achieved, causing quota->esz_bp
to drop to zero. It adds checks for zero charged_sz and zero esz to
prevent unexpectedly increasing qt_exceeds.
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index df22621765911..f8c784df24600 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -2655,6 +2655,8 @@ static bool damos_quota_is_full(struct damos_quota *quota,
> {
> if (!damos_quota_is_set(quota))
> return false;
> + if (!quota->charged_sz)
> + return false;
[Severity: Medium]
Does this unconditionally bypass the remaining quota check when no regions
have been charged yet?
If a DAMOS scheme is evaluated with an effective quota (quota->esz) that
is greater than 0 but strictly less than c->min_region_sz, returning false
here skips the final check in this function:
return quota->esz - quota->charged_sz < min_region_sz;
Could this cause the scheme to continue evaluating all targets and regions,
only to calculate a zero size later in damos_apply_scheme() due to
insufficient quota? This would artificially inflate s->stat.nr_tried for
every region while wasting CPU cycles applying zero bytes.
> if (quota->charged_sz >= quota->esz)
> return true;
[ ... ]
> @@ -2750,6 +2752,9 @@ static void damon_do_apply_schemes(struct damon_ctx *c,
> if (!s->wmarks.activated)
> continue;
>
> + if (!quota->esz)
> + continue;
> +
[Severity: High]
Will this newly added check completely skip valid DAMOS schemes that simply
do not have quotas configured?
When a user creates a scheme without quota limits (ms == 0, sz == 0, and
no goals), damos_quota_init() initializes quota->esz to 0. Since
damos_adjust_quota() leaves esz unmodified for un-set quotas, esz remains 0.
Because this check happens before damos_quota_is_full() (which normally
handles non-quota schemes safely by returning false via damos_quota_is_set()),
won't this cause damon_do_apply_schemes() to unconditionally skip all
schemes that lack a quota?
> /* Check the quota */
> if (damos_quota_is_full(quota, c->min_region_sz))
> continue;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260902081825.18931-1-aethernet65535@gmail.com?part=1
next prev parent reply other threads:[~2026-09-02 8:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 8:18 [PATCH v2] mm/damon/core: fix false positive in Liew Rui Yan
2026-09-02 8:29 ` sashiko-bot [this message]
2026-09-02 9:02 ` Liew Rui Yan
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=20260902082931.4536F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aethernet65535@gmail.com \
--cc=damon@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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