From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH 4/6] mm/damon/sysfs-schemes: setup range_{min,max} for probe_hits_wsum filter
Date: Sun, 06 Sep 2026 21:16:17 +0000 [thread overview]
Message-ID: <20260906211617.9ED221F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260906210513.106895-5-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incorrect union member assignment for PROBE_HITS_WSUM filter type risks silent corruption if struct layout changes.
--
commit 67e5bf0750883cfdf7b8857b78d72c17c2de406e
Author: SJ Park <sj@kernel.org>
mm/damon/sysfs-schemes: setup range_{min,max} for probe_hits_wsum filter
This commit extends the DAMON sysfs interface to support probe_hits_wsum
input. It updates the sysfs input based scheme build logic to set up the
min/max probe hits weighted sum range provided by the user.
> diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
> index 4d9147d2a269e..e297a20c0af03 100644
> --- a/mm/damon/sysfs-schemes.c
> +++ b/mm/damon/sysfs-schemes.c
[ ... ]
> @@ -2844,6 +2847,14 @@ static int damon_sysfs_add_scheme_filters(struct damos *scheme,
> }
> filter->sz_range.min = sysfs_filter->range_min;
> filter->sz_range.max = sysfs_filter->range_max;
> + } else if (filter->type == DAMOS_FILTER_TYPE_PROBE_HITS_WSUM) {
> + if (sysfs_filter->range_min >
> + sysfs_filter->range_max) {
> + damos_destroy_filter(filter);
> + return -EINVAL;
> + }
> + filter->sz_range.min = sysfs_filter->range_min;
> + filter->sz_range.max = sysfs_filter->range_max;
[Severity: Low]
Is this assigning to the wrong union member? Since the filter type is
DAMOS_FILTER_TYPE_PROBE_HITS_WSUM, should this be assigning directly to
filter->range_min and filter->range_max instead of filter->sz_range?
While struct damon_size_range and the anonymous { unsigned long range_min;
unsigned long range_max; } struct currently share the exact same memory layout
in the struct damos_filter union, using sz_range here appears to be a
copy-paste error from the DAMOS_FILTER_TYPE_HUGEPAGE_SIZE block.
This seems to bypass the earlier refactoring that explicitly introduced
the anonymous struct to avoid reusing sz_range for non-size fields. If
struct damon_size_range is modified in the future, assigning via sz_range
while the core logic consumes range_min could lead to silent data corruption
when building a PROBE_HITS_WSUM scheme filter.
> }
>
> damos_add_filter(scheme, filter);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260906210513.106895-1-sj@kernel.org?part=4
next prev parent reply other threads:[~2026-09-06 21:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 21:05 [RFC PATCH 0/6] mm/damon: introduce probe_hits_wsum DAMOS core filter SJ Park
2026-09-06 21:05 ` [RFC PATCH 1/6] mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM SJ Park
2026-09-06 21:13 ` sashiko-bot
2026-09-06 21:15 ` SJ Park
2026-09-06 21:05 ` [RFC PATCH 2/6] mm/damon/core: support probe_hits_wsum damos core filter SJ Park
2026-09-06 21:17 ` sashiko-bot
2026-09-06 21:29 ` SJ Park
2026-09-06 21:05 ` [RFC PATCH 3/6] mm/damon/sysfs-schemes: rename sysfs_filter->sz_range to range_{min,max} SJ Park
2026-09-06 21:11 ` sashiko-bot
2026-09-06 21:05 ` [RFC PATCH 4/6] mm/damon/sysfs-schemes: setup range_{min,max} for probe_hits_wsum filter SJ Park
2026-09-06 21:16 ` sashiko-bot [this message]
2026-09-06 21:30 ` SJ Park
2026-09-06 21:05 ` [RFC PATCH 5/6] Docs/mm/damon/design: update for probe_hits_wsum DAMOS core filter SJ Park
2026-09-06 21:07 ` sashiko-bot
2026-09-06 21:05 ` [RFC PATCH 6/6] Docs/admin-guide/mm/damon/usage: update for probe_hits_wsum DAMOS filter SJ Park
2026-09-06 21:11 ` 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=20260906211617.9ED221F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sj@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