From: SJ Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SJ Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: [PATCH 6.6.y v3 1/2] mm/damon/core: do non-safe region walk on kdamond_apply_schemes()
Date: Fri, 9 Oct 2026 07:07:49 -0700 [thread overview]
Message-ID: <20261009140750.11948-1-sj@kernel.org> (raw)
In-Reply-To: <sashiko-outbox-165685@kernel.org>
On Fri, 09 Oct 2026 14:02:33 +0000 sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] mm: damon: double processing of split regions by earlier schemes
> --
>
> commit de615e5101d6a41f308fef487cc464f7d25abb6e
> Author: SeongJae Park <sj@kernel.org>
>
> mm/damon/core: do non-safe region walk on kdamond_apply_schemes()
>
> This commit replaces the safe region iterator with damon_for_each_region()
> in kdamond_apply_schemes() to ensure newly split regions are not ignored
> during iteration. It also simplifies damos_skip_charged_region() by
> removing a workaround that updated the region pointer directly.
>
> Link: https://lkml.kernel.org/r/20260227170623.95384-3-sj@kernel.org
>
> > diff --git a/mm/damon/core.c b/mm/damon/core.c
> > index fe91b296f4c66..c86cac855b9b0 100644
> > --- a/mm/damon/core.c
> > +++ b/mm/damon/core.c
>
> [ ... ]
>
> > @@ -1134,7 +1134,7 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
> > static void kdamond_apply_schemes(struct damon_ctx *c)
> > {
> > struct damon_target *t;
> > - struct damon_region *r, *next_r;
> > + struct damon_region *r;
> > struct damos *s;
> > unsigned long sample_interval = c->attrs.sample_interval ?
> > c->attrs.sample_interval : 1;
> > @@ -1156,7 +1156,7 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
> > return;
> >
> > damon_for_each_target(t, c) {
> > - damon_for_each_region_safe(r, next_r, t)
> > + damon_for_each_region(r, t)
> > damon_do_apply_schemes(c, t, r);
>
> [Severity: Medium]
> Will this change cause earlier schemes to re-process newly split regions?
>
> When damon_do_apply_schemes() evaluates a region, it sequentially iterates
> through all schemes. If an earlier scheme processes the region, it applies
> its action and updates its quota.
>
> If a later scheme then hits an address filter or quota while evaluating the
> same region, it splits the region, shrinking it and inserting a new remainder
> region immediately after it in the target list.
>
> Because the outer loop now dynamically fetches the next region via
> damon_for_each_region(), this newly inserted remainder region is evaluated
> in the very next iteration.
>
> When damon_do_apply_schemes() processes this remainder region, it starts over
> from the first scheme. Won't this cause the earlier scheme to re-evaluate
> and apply its action a second time, potentially artificially double-charging
> its quota and redundantly applying physical memory operations?
Minor impact issue that also exist in the mainline. Hence no blocker of this
series in my opinion. I will separately work on the issue.
>
> > }
> >
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261009134949.11507-1-sj@kernel.org?part=1
>
Thanks,
SJ
next prev parent reply other threads:[~2026-10-09 14:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2026092948-moonrise-persecute-3597@gregkh>
2026-09-30 9:37 ` [PATCH 6.6.y] mm/damon/core: fix unconditionally skip last region SJ Park
2026-09-30 9:54 ` sashiko-bot
2026-09-30 10:06 ` SJ Park
2026-09-30 10:08 ` SJ Park
2026-09-30 10:18 ` [PATCH 6.6.y v2] " SJ Park
2026-09-30 10:31 ` sashiko-bot
2026-09-30 10:35 ` SJ Park
2026-10-02 14:19 ` Sasha Levin
2026-10-02 18:03 ` SJ Park
2026-10-09 13:49 ` [PATCH 6.6.y v3 0/2] mm/damon/core: fix last region handling of damos_skip_charged_regions() SJ Park
2026-10-09 13:49 ` [PATCH 6.6.y v3 1/2] mm/damon/core: do non-safe region walk on kdamond_apply_schemes() SJ Park
2026-10-09 14:02 ` sashiko-bot
2026-10-09 14:07 ` SJ Park [this message]
2026-10-09 13:49 ` [PATCH 6.6.y v3 2/2] mm/damon/core: fix unconditionally skip last region SJ Park
2026-10-09 14:05 ` sashiko-bot
2026-10-09 14:08 ` SJ 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=20261009140750.11948-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox