From: sashiko-bot@kernel.org
To: "Suhaas Joshi" <suhaas@s-joshi.in>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH v2 2/2] mm/damon/core: Copy only installed probe in damon_split_region_at()
Date: Thu, 08 Oct 2026 15:32:29 +0000 [thread overview]
Message-ID: <sashiko-outbox-164347@kernel.org> (raw)
In-Reply-To: <20261008151944.113714-3-suhaas@s-joshi.in>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] mm: damon: performance degradation replacing memcpy with linked list traversal
- [Low] mm: damon: build failure in KUnit test due to missing argument in damos_skip_charged_region()
--
commit 2a85f15b49d0115f937574a91868632edfb71225
Author: Suhaas Joshi <suhaas@s-joshi.in>
mm/damon/core: Copy only installed probe in damon_split_region_at()
This commit updates damon_split_region_at() to iterate only over installed
probes when copying probe hits, instead of copying the entire array. It
introduces a struct damon_ctx pointer parameter to the function to facilitate
this change. It also updates its callers to pass the new argument.
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index fc202f90991b0..9e5a19c2a19d0 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
[ ... ]
> @@ -3686,11 +3691,13 @@ static int damon_split_region_at(struct damon_target *t,
> new->age = r->age;
> new->last_nr_accesses = r->last_nr_accesses;
> new->nr_accesses = r->nr_accesses;
> - /* todo: do this for only installed probes */
> - memcpy(new->probe_hits, r->probe_hits, sizeof(r->probe_hits));
> - memcpy(new->last_probe_hits, r->last_probe_hits,
> - sizeof(r->last_probe_hits));
>
> + i = 0;
> + damon_for_each_probe(p, ctx) {
> + new->probe_hits[i] = r->probe_hits[i];
> + new->last_probe_hits[i] = r->last_probe_hits[i];
> + ++i;
> + }
[Severity: Low]
Since DAMON_MAX_PROBES is fixed to 4, the original memcpy() copied exactly
4 bytes and was typically optimized into a single register load/store.
Does replacing this with a damon_for_each_probe() linked list traversal
introduce unnecessary execution overhead in this hot path? The indirection
and branch checks to serve as an array copy counter might be a performance
degradation compared to the optimized memcpy().
> damon_insert_region(new, r, damon_next_region(r), t);
> return 0;
> }
[ ... ]
> diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
> index ec953426b8403..a3dd31f3b112e 100644
> --- a/mm/damon/tests/core-kunit.h
> +++ b/mm/damon/tests/core-kunit.h
[ ... ]
> @@ -1868,6 +1899,7 @@ static void damos_test_filter_out(struct kunit *test)
> damon_destroy_region(r2, t);
>
> out:
> + damon_destroy_ctx(ctx);
> damon_free_target(t);
> damos_free_filter(f);
> }
[Severity: Low]
The patch modifies the signature of damos_skip_charged_region() to accept a
new struct damon_ctx pointer as its first parameter, but it looks like the
invocation in damon_test_last_region_quota_reset() was missed:
mm/damon/tests/core-kunit.h:damon_test_last_region_quota_reset() {
...
skipped = damos_skip_charged_region(t, r2, &s, min_region_sz);
...
}
Will this cause a build failure for too few arguments when the kernel is
built with CONFIG_DAMON_KUNIT_TEST=y?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008151944.113714-2-suhaas@s-joshi.in?part=2
next prev parent reply other threads:[~2026-10-08 15:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261008151944.113714-1-suhaas@s-joshi.in>
2026-10-08 15:19 ` [PATCH v2 1/2] mm/damon/core: Use only installed probe in damon_merge_two_regions() Suhaas Joshi
2026-10-08 15:31 ` sashiko-bot
2026-10-08 15:33 ` Suhaas Joshi
2026-10-09 7:46 ` SJ Park
2026-10-09 7:43 ` SJ Park
2026-10-08 15:19 ` [PATCH v2 2/2] mm/damon/core: Copy only installed probe in damon_split_region_at() Suhaas Joshi
2026-10-08 15:32 ` sashiko-bot [this message]
2026-10-09 2:40 ` kernel test robot
2026-10-09 8:21 ` SJ Park
2026-10-09 15:43 ` Suhaas Joshi
2026-10-09 4:06 ` kernel test robot
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=sashiko-outbox-164347@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=suhaas@s-joshi.in \
/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