All of lore.kernel.org
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SeongJae Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: [RFC PATCH v1.2 09/17] mm/damon/core: remove damon_verify_merge_regions_of()
Date: Sun, 21 Jun 2026 13:35:47 -0700	[thread overview]
Message-ID: <20260621203548.10718-1-sj@kernel.org> (raw)
In-Reply-To: <20260621180955.442ED1F000E9@smtp.kernel.org>

On Sun, 21 Jun 2026 18:09:54 +0000 sashiko-bot@kernel.org wrote:

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> 
> Pre-existing issues:
> - [High] Missing size-weighted averaging for `last_nr_accesses` upon region merge causes erroneous age resets and corrupted metrics.
> --
> 
> commit 6d81112ae07520e7dd1deaeaf23912d17d4d8a57
> Author: SeongJae Park <sj@kernel.org>
> 
> mm/damon/core: remove damon_verify_merge_regions_of()
> 
> This commit removes the damon_verify_merge_regions_of() validation check.
> The nr_accesses_bp field is no longer used for a real purpose, making this
> validation unnecessary.
> 
> > diff --git a/mm/damon/core.c b/mm/damon/core.c
> > index ee19238d62f5f..94d8ec2965451 100644
> > --- a/mm/damon/core.c
> > +++ b/mm/damon/core.c
> > @@ -3114,20 +3114,6 @@ static void damon_merge_two_regions(struct damon_target *t,
> >  	damon_destroy_region(r, t);
> >  }
> 
> [Severity: High]
> This is a pre-existing issue, but does damon_merge_two_regions() need to
> calculate a size-weighted average for last_nr_accesses alongside nr_accesses
> and age?
> 
> Currently, when two adjacent regions are combined, last_nr_accesses appears
> to be omitted from the averaging logic, causing the newly merged region to
> strictly inherit the left region's history.
> 
> Because kdamond_merge_regions() iterates its merge loop until the region
> limit is satisfied, a region merged in the first iteration will be evaluated
> again in the second iteration:
> 
> mm/damon/core.c:damon_merge_regions_of() {
>         ...
>         if (abs(r->nr_accesses - r->last_nr_accesses) > thres)
>                 r->age = 0;
>         ...
> }
> 
> Since r->nr_accesses was size-averaged but r->last_nr_accesses was not,
> this comparison evaluates against mismatched data. Could this frequently
> cause it to erroneously reset r->age to 0?
> 
> If so, this seems like it might break DAMON schemes that rely on region age
> (such as pageout schemes meant to reclaim cold memory) by continuously
> resetting the region's age. It might also skew policy frequency scores in
> damon_nr_accesses_mvsum() if damon_set_attrs() is called from a user context
> before the aggregation interval resets.

Good finding, but not necessarily a blocker of this series.  I will separately
work on this.


Thanks,
SJ

[...]

  reply	other threads:[~2026-06-21 20:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-21 15:56 [RFC PATCH v1.2 00/17] mm/damon: optimize out nr_accesses_bp SeongJae Park
2026-06-21 15:56 ` [RFC PATCH v1.2 01/17] mm/damon: introduce damon_nr_accesses_mvsum() SeongJae Park
2026-06-21 16:10   ` sashiko-bot
2026-06-21 20:01     ` SeongJae Park
2026-06-21 15:56 ` [RFC PATCH v1.2 02/17] mm/damon/tests/core-kunit: test damon_mvsum() SeongJae Park
2026-06-21 15:56 ` [RFC PATCH v1.2 03/17] mm/damon/core: always update ->last_nr_accesses for intervals change SeongJae Park
2026-06-21 16:11   ` sashiko-bot
2026-06-21 20:23     ` SeongJae Park
2026-06-21 21:13       ` SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 04/17] mm/damon/core: use damon_nr_accesses_mvsum() in __damos_valid_target() SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 05/17] mm/damon/core: use damon_nr_accesses_mvsum() for damos region tracing SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 06/17] mm/damon/sysfs-schemes: use damon_nr_accesses_mvsum() for damo regions SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 07/17] mm/damon/core: remove damon_warn_fix_nr_accesses_corruption() SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 08/17] mm/damon/core: remove damon_verify_reset_aggregated() SeongJae Park
2026-06-21 16:06   ` sashiko-bot
2026-06-21 20:24     ` SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 09/17] mm/damon/core: remove damon_verify_merge_regions_of() SeongJae Park
2026-06-21 18:09   ` sashiko-bot
2026-06-21 20:35     ` SeongJae Park [this message]
2026-06-21 15:57 ` [RFC PATCH v1.2 10/17] mm/damon/tests/core-kunit: remove nr_accesses_bp setup and tests SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 11/17] selftests/damon/drgn_dump_damon_status: do not dump nr_accesses_bp SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 12/17] mm/damon/core: remove nr_accesses_bp setups and updates SeongJae Park
2026-06-21 18:10   ` sashiko-bot
2026-06-21 20:37     ` SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 13/17] mm/damon/core: remove attrs param from damon_update_region_access_rate() SeongJae Park
2026-06-21 16:14   ` sashiko-bot
2026-06-21 20:40     ` SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 14/17] mm/damonn/paddr: remove attrs param from __damon_pa_check_access() SeongJae Park
2026-06-21 16:07   ` sashiko-bot
2026-06-21 20:42     ` SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 15/17] mm/damon/vaddr: remove attrs param from __damon_va_check_access() SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 16/17] mm/damon/core: remove damon_moving_sum() and its unit test SeongJae Park
2026-06-21 15:57 ` [RFC PATCH v1.2 17/17] mm/damon: remove damon_region->nr_accesses_bp 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=20260621203548.10718-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=sashiko-bot@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.