From: SeongJae Park <sj@kernel.org>
To: SeongJae Park <sj@kernel.org>
Cc: damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: (sashiko review) [RFC PATCH v5 02/11] mm/damon/core: merge quota-sliced regions back
Date: Sat, 11 Apr 2026 09:33:39 -0700 [thread overview]
Message-ID: <20260411163340.46397-1-sj@kernel.org> (raw)
In-Reply-To: <20260410235527.90900-1-sj@kernel.org>
On Fri, 10 Apr 2026 16:55:26 -0700 SeongJae Park <sj@kernel.org> wrote:
[...]
> > Should the merge condition verify that the contiguous slices share identical
> > state before merging, perhaps by checking if (orig_region->age != r->age)?
>
> Good finding. I was thinking the scheme will anyway be applied, once the
> quota-split is happened. But I was wrong, since DAMOS core filter is applied
> after the split operation. Also, age is not reset if the action is DAMOS_STAT.
>
> I will address this in the next revision, like below.
>
> '''
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -2439,35 +2439,32 @@ static void damon_do_apply_schemes(struct damon_ctx *c,
>
> static void damos_apply_target(struct damon_ctx *c, struct damon_target *t)
> {
> - struct damon_region *r, *orig_region = NULL;
> - unsigned long orig_end_addr;
> + struct damon_region *r;
>
> damon_for_each_region(r, t) {
> + struct damon_region *prev_r;
> +
> + damon_do_apply_schemes(c, t, r);
> /*
> - * damon_do_apply_schemes() could split the region for the
> + * damon_do_apply_scheems() could split the region for the
> * quota. Keeping the new slices is an overhead. Merge back
> - * the slices into the original region if there is no reason to
> - * keep those.
> + * the slices into the previous region if it doesn't lose any
> + * information.
> */
> - if (!orig_region || orig_end_addr <= r->ar.start) {
> - orig_region = r;
> - orig_end_addr = r->ar.end;
> - }
> - damon_do_apply_schemes(c, t, r);
> - if (r == orig_region)
> + if (damon_first_region(t) == r)
> continue;
> - /*
> - * If no scheme was applied to the sliced region, the age of
> - * the slice ain't be reset. Don't merge that back.
> - * Otherwise, the monitored information of the region is lost.
> - */
> - if (r->age) {
> - orig_region = NULL;
> + prev_r = damon_prev_region(r);
> + if (prev_r->ar.end != r->ar.start)
> continue;
> - }
> - orig_region->ar.end = r->ar.end;
> + if (prev_r->age != r->age)
> + continue;
> + if (prev_r->last_nr_accesses != r->last_nr_accesses)
> + continue;
> + if (prev_r->nr_accesses != r->nr_accesses)
> + continue;
> + prev_r->ar.end = r->ar.end;
> damon_destroy_region(r, t);
> - r = orig_region;
> + r = prev_r;
> }
> }
This could result in too aggressive merging, that can make the number of
regions lower than the min_nr_regions. Actually this makes one of damo tests
fail. I will fix this by using damon_region_sz_limit().
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-04-11 16:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-10 14:20 [RFC PATCH v5 00/11] mm/damon: introduce DAMOS failed region quota charge ratio SeongJae Park
2026-04-10 14:20 ` [RFC PATCH v5 01/11] mm/damon/core: handle <min_region_sz remaining quota as empty SeongJae Park
2026-04-10 23:32 ` (sashiko review) " SeongJae Park
2026-04-10 14:20 ` [RFC PATCH v5 02/11] mm/damon/core: merge quota-sliced regions back SeongJae Park
2026-04-10 23:55 ` (sashiko review) " SeongJae Park
2026-04-11 16:33 ` SeongJae Park [this message]
2026-04-10 14:20 ` [RFC PATCH v5 03/11] mm/damon/core: introduce failed region quota charge ratio SeongJae Park
2026-04-10 23:56 ` (sashiko review) " SeongJae Park
2026-04-10 14:20 ` [RFC PATCH v5 04/11] mm/damon/sysfs-schemes: implement fail_charge_{num,denom} files SeongJae Park
2026-04-10 23:58 ` (sashiko review) " SeongJae Park
2026-04-10 14:20 ` [RFC PATCH v5 05/11] Docs/mm/damon/design: document fail_charge_{num,denom} SeongJae Park
2026-04-10 14:20 ` [RFC PATCH v5 06/11] Docs/admin-guide/mm/damon/usage: document fail_charge_{num,denom} files SeongJae Park
2026-04-10 14:20 ` [RFC PATCH v5 07/11] Docs/ABI/damon: document fail_charge_{num,denom} SeongJae Park
2026-04-10 14:20 ` [RFC PATCH v5 08/11] mm/damon/tests/core-kunit: test fail_charge_{num,denom} committing SeongJae Park
2026-04-10 14:20 ` [RFC PATCH v5 09/11] selftests/damon/_damon_sysfs: support failed region quota charge ratio SeongJae Park
2026-04-10 14:20 ` [RFC PATCH v5 10/11] selftests/damon/drgn_dump_damon_status: " SeongJae Park
2026-04-10 14:20 ` [RFC PATCH v5 11/11] selftests/damon/sysfs.py: test " 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=20260411163340.46397-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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