From: sashiko-bot@kernel.org
To: "Ravi Jonnalagadda" <ravis.opensrc@gmail.com>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH v3 8/9] mm/damon/core: cap the region merge threshold per target
Date: Sat, 03 Oct 2026 21:18:07 +0000 [thread overview]
Message-ID: <20261003211807.D81871F0089B@smtp.kernel.org> (raw)
In-Reply-To: <20261003-damon-perf-rfc-v3-send-2026-10-03-v3-8-0f00417b41bc@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mm/damon: region bound violation when probe weights exceed max_thres
--
commit 0342e0b2c0ad1539186d08fbb17c049c0f491a79
Author: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
mm/damon/core: cap the region merge threshold per target
kdamond_merge_regions() applies one context-wide threshold, the highest
merge score across all targets divided by 10, to every target. This commit
caps the threshold for each target by a tenth of its own maximum merge score
on the regular merge pass.
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 1d25f820e3f93..c2c74d0daf957 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -4175,12 +4175,36 @@ static noinline_for_stack void kdamond_merge_regions(struct damon_ctx *c,
> unsigned int nr_regions;
> unsigned int max_thres;
> bool count_age = true;
> + bool use_probe_hits = damon_has_probe_weights(c);
>
> max_thres = damon_nr_samples_per_aggr(&c->attrs);
> while (true) {
> nr_regions = 0;
> damon_for_each_target(t, c) {
> - damon_merge_regions_of(t, threshold, sz_limit, c,
> + struct damon_region *r;
> + unsigned int t_max = 0, t_thres = threshold;
> +
> + /*
> + * On the regular pass, cap the threshold by this
> + * target's own maximum merge score.
[ ... ]
> + */
> + if (count_age) {
> + damon_for_each_region(r, t)
> + t_max = max(t_max, damon_merge_score(r,
> + false, c, use_probe_hits));
> + t_thres = min(threshold, t_max / 10);
[Severity: High]
Does this cap the merge threshold for the cold target to near-zero, ensuring it
is highly fragmented on the first pass?
> + }
> + damon_merge_regions_of(t, t_thres, sz_limit, c,
> count_age);
> nr_regions += damon_nr_regions(t);
> }
> count_age = false;
> if (nr_regions <= c->attrs.max_nr_regions ||
> max_thres <= threshold)
> break;
[Severity: High]
When DAMON is configured with event probes using high weights, does this break
the loop immediately if the weighted initial threshold exceeds the unweighted
max_thres?
If so, does this prevent the uncapped fallback passes from ever running to
satisfy the region count bound?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261003-damon-perf-rfc-v3-send-2026-10-03-v3-0-0f00417b41bc@gmail.com?part=8
next prev parent reply other threads:[~2026-10-03 21:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-03 21:07 [RFC PATCH v3 0/9] mm/damon: hardware-sampled access reports Ravi Jonnalagadda
2026-10-03 21:07 ` [RFC PATCH v3 1/9] mm/damon/paddr: remove page_fault access check primitive Ravi Jonnalagadda
2026-10-03 21:20 ` sashiko-bot
2026-10-03 21:07 ` [RFC PATCH v3 2/9] mm/damon/core: replace the access report buffer with per-context rings Ravi Jonnalagadda
2026-10-03 21:22 ` sashiko-bot
2026-10-04 8:30 ` Kunwu Chan
2026-10-05 9:09 ` Ravi Jonnalagadda
2026-10-04 9:10 ` Kunwu Chan
2026-10-05 9:11 ` Ravi Jonnalagadda
2026-10-03 21:07 ` [RFC PATCH v3 3/9] mm/damon: add perf-event overflow handler feeding the report ring Ravi Jonnalagadda
2026-10-03 21:22 ` sashiko-bot
2026-10-03 21:07 ` [RFC PATCH v3 4/9] mm/damon/ops-common: use probe-weighted score when probe weights are set Ravi Jonnalagadda
2026-10-03 21:15 ` sashiko-bot
2026-10-03 21:07 ` [RFC PATCH v3 5/9] mm/damon: add perf_event prep type, core lifecycle, and PMU arm/disarm Ravi Jonnalagadda
2026-10-03 21:07 ` [RFC PATCH v3 6/9] mm/damon/sysfs: expose perf_event prep attributes Ravi Jonnalagadda
2026-10-03 21:20 ` sashiko-bot
2026-10-03 21:08 ` [RFC PATCH v3 7/9] mm/damon/tests/drain-kunit: kunit for report rings and ring drain Ravi Jonnalagadda
2026-10-03 21:17 ` sashiko-bot
2026-10-03 21:08 ` [RFC PATCH v3 8/9] mm/damon/core: cap the region merge threshold per target Ravi Jonnalagadda
2026-10-03 21:18 ` sashiko-bot [this message]
2026-10-03 21:08 ` [RFC PATCH v3 9/9] mm/damon/core: allow both primitives disabled when a perf probe is present Ravi Jonnalagadda
2026-10-03 21:20 ` sashiko-bot
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=20261003211807.D81871F0089B@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=ravis.opensrc@gmail.com \
--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