All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>, "Andrew Morton" <akpm@linux-foundation.org>
Cc: damon@lists.linux.dev, linux-mm@kvack.org
Subject: Re: [PATCH v2 2/3] mm/damon/core: apply damos core filter in __damos_valid_target()
Date: Thu, 03 Dec 2026 15:26:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-248105@kernel.org> (raw)
In-Reply-To: <20261203150821.730276-3-sj@kernel.org>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] mm/damon: core filter runs before access pattern in
  __damos_valid_target()
- [Low] mm/damon: commit message misstates parameter added to
  __damos_valid_target()
- [Low] mm/damon: redundant damon_sz_region() assignment in
  damos_apply_scheme()
--

commit 65ff401f1d42c531dc70b0b39a702a59a8905c6f
Author: SJ Park <sj@kernel.org>

mm/damon/core: apply damos core filter in __damos_valid_target()

This commit moves DAMOS core filter evaluation into __damos_valid_target()
and splits out damos_access_pattern_eligible() for callers that only check
the access pattern.

> Treat DAMOS core filter as the primary method.  Handle core filters and
> damos_access_pattern together in the central region selection function,
> __damos_valid_target().  Update __damos_valid_target() to receive
> damon_ctx, to allow it access to core filters.

[Severity: Low]
__damos_valid_target() already received struct damon_ctx *c; this commit
adds struct damon_target *t so it can be passed to damos_core_filter_out().

> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 2766ebec01501..b0e9325e032b6 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c

[ ... ]

> @@ -2550,6 +2554,15 @@ static bool __damos_valid_target(struct damon_region *r, struct damos *s,
>  		r->age <= s->pattern.max_age_region;
>  }
>  
> +static bool __damos_valid_target(struct damon_region *r, struct damos *s,
> +		struct damon_ctx *c, struct damon_target *t)
> +{
> +	if (damos_core_filter_out(c, t, r, s))
> +		return false;
> +
> +	return damos_access_pattern_eligible(r, s, c);
> +}

[Severity: Medium]
Can running damos_core_filter_out() before damos_access_pattern_eligible()
cause DAMOS_FILTER_TYPE_ADDR splits to break region size checks?

For a partially overlapping DAMOS_FILTER_TYPE_ADDR filter,
damos_filter_match() calls damon_split_region_at() and shrinks r in place.
damos_access_pattern_eligible() then checks min_sz_region and max_sz_region
against the post-split slice instead of the original region.

A region larger than max_sz_region can then be split into a smaller slice
and erroneously receive the scheme action, while an eligible region with a
narrower filter overlap is falsely rejected under min_sz_region.  Regions
failing nr_accesses or age are also split before later schemes evaluate them.

Checking damos_access_pattern_eligible() before damos_core_filter_out()
would preserve the previous semantics.

[ ... ]

> @@ -2896,8 +2909,6 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
>  	}
>  
>  	if (c->ops.apply_scheme) {
> -		if (damos_core_filter_out(c, t, r, s))
> -			return;
>  		sz = damon_sz_region(r);
>  		if (damos_quota_is_set(quota) &&
>  				quota->charged_sz + sz > quota->esz) {

[Severity: Low]
Is this sz = damon_sz_region(r) assignment now redundant?  sz is already
initialized to damon_sz_region(r) at the start of damos_apply_scheme(), and
nothing modifies r in between now that damos_core_filter_out() has been
removed here.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203150821.730276-1-sj@kernel.org?part=2


  reply	other threads:[~2026-12-03 15:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 15:08 [PATCH v2 0/3] mm/damon: treat DAMOS core filters as a primary target selection method SJ Park
2026-12-03 15:08 ` [PATCH v2 1/3] mm/damon/tests/core-kunit: drop apply_scheme()-internal filter tests SJ Park
2026-12-03 15:19   ` sashiko-bot
2026-12-03 15:36     ` SJ Park
2026-12-03 15:08 ` [PATCH v2 2/3] mm/damon/core: apply damos core filter in __damos_valid_target() SJ Park
2026-12-03 15:26   ` sashiko-bot [this message]
2026-12-03 15:40     ` SJ Park
2026-12-03 15:08 ` [PATCH v2 3/3] mm/damon/api: clarify node_eligible_mem_bp is access pattern-eligible SJ Park
2026-12-03 15:26 ` [PATCH v2 0/3] mm/damon: treat DAMOS core filters as a primary target selection method sashiko-bot
2026-12-03 15:42 ` 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=sashiko-outbox-248105@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-mm@kvack.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.