From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH v1.1 3/5] mm/damon/vaddr: drop last same folio access check optimization
Date: Sun, 12 Jul 2026 17:10:09 +0000 [thread overview]
Message-ID: <20260712171009.F295E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260712170328.91144-4-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Unused parameter and dead code tracking logic left behind after removing optimization.
--
--- Patch [3]: [RFC PATCH v1.1 3/5] mm/damon/vaddr: drop last same folio access check optimization ---
commit 40e12defdea3b013644cc026283aa34cdd3ae2fb
Author: SJ Park <sj@kernel.org>
mm/damon/vaddr: drop last same folio access check optimization
This commit removes the last same folio access check optimization from DAMON's
virtual address space primitives. The optimization was found to cause race
conditions when multiple kdamonds are running.
> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> index d10b8042adb5b..16fe210d2042a 100644
> --- a/mm/damon/vaddr.c
> +++ b/mm/damon/vaddr.c
[ ... ]
> @@ -496,26 +489,15 @@ static bool damon_va_young(struct mm_struct *mm, unsigned long addr,
> static void __damon_va_check_access(struct mm_struct *mm,
> struct damon_region *r, bool same_target)
> {
[Severity: Low]
Does this code still need the same_target parameter?
With the optimization removed below, the parameter is no longer used in
__damon_va_check_access().
The caller, damon_va_check_accesses(), also still computes and tracks the local
same_target variable on every iteration just to pass it here:
damon_for_each_target(t, ctx) {
mm = damon_get_mm(t);
same_target = false;
damon_for_each_region(r, t) {
__damon_va_check_access(mm, r, same_target);
max_nr_accesses = max(r->nr_accesses, max_nr_accesses);
same_target = true;
}
if (mm)
mmput(mm);
}
Could we remove the parameter and the dead tracking code in the caller as well?
> - static unsigned long last_addr;
> - static unsigned long last_folio_sz = PAGE_SIZE;
> - static bool last_accessed;
> + bool accessed;
>
> if (!mm) {
> damon_update_region_access_rate(r, false);
> return;
> }
>
> - /* If the region is in the last checked page, reuse the result */
> - if (same_target && (ALIGN_DOWN(last_addr, last_folio_sz) ==
> - ALIGN_DOWN(r->sampling_addr, last_folio_sz))) {
> - damon_update_region_access_rate(r, last_accessed);
> - return;
> - }
> -
> - last_accessed = damon_va_young(mm, r->sampling_addr, &last_folio_sz);
> - damon_update_region_access_rate(r, last_accessed);
> -
> - last_addr = r->sampling_addr;
> + accessed = damon_va_young(mm, r->sampling_addr);
> + damon_update_region_access_rate(r, accessed);
> }
>
> static unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260712170328.91144-1-sj@kernel.org?part=3
next prev parent reply other threads:[~2026-07-12 17:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-12 17:03 [RFC PATCH v1.1 0/5] mm/damon: unurgent fixes for infinite loop, NULL de-ref and races SJ Park
2026-07-12 17:03 ` [RFC PATCH v1.1 1/5] mm/damon/core: avoid infinite kdamond_merge_regions() internal loop SJ Park
2026-07-12 17:03 ` [RFC PATCH v1.1 2/5] mm/damon/tests/core-kunit: catch test failure in test_merge_regions_of() SJ Park
2026-07-12 17:03 ` [RFC PATCH v1.1 3/5] mm/damon/vaddr: drop last same folio access check optimization SJ Park
2026-07-12 17:10 ` sashiko-bot [this message]
2026-07-12 17:24 ` SJ Park
2026-07-12 17:03 ` [RFC PATCH v1.1 4/5] mm/damon/paddr: drop last same folio access check reuse optimization SJ Park
2026-07-12 17:03 ` [RFC PATCH v1.1 5/5] mm/damon/sysfs: read ops_id only once 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=20260712171009.F295E1F000E9@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