From: Baoquan He <baoquan.he@linux.dev>
To: sashiko-reviews@lists.linux.dev
Cc: linux-mm@kvack.org, david@kernel.org, akpm@linux-foundation.org,
kasong@tencent.com, baohua@kernel.org, qi.zheng@linux.dev,
shakeel.butt@linux.dev, axelrasmussen@google.com,
yuanchu@google.com, weixugc@google.com,
baolin.wang@linux.alibaba.com, Baoquan He <hebaoquan@kylinos.cn>
Subject: Re: [PATCH v5 4/4] mm/mglru: count PUD subtrees skipped by the PUD-level filter
Date: Wed, 25 Nov 2026 10:22:57 +0800 [thread overview]
Message-ID: <awZGgSrYIuOFoLwZ@bogon> (raw)
In-Reply-To: <sashiko-outbox-230767@kernel.org>
On 11/24/26 at 08:59am, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] mm/mglru: lost young return from walk_pmd_range_locked() in
> walk_pmd_range()
> --
>
> commit 3dc8080e8c434c4239bc40252f11504dbbdb29f3
> Author: Baoquan He <hebaoquan@kylinos.cn>
>
> mm/mglru: count PUD subtrees skipped by the PUD-level filter
>
> This commit adds MM_PUD_EMPTY_SKIPPED to count PUD subtrees skipped by the
> PUD-level Bloom filter and exposes it in debugfs and the
> mm_vmscan_lru_gen_walk tracepoint.
>
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 517f5fbecdbf7..56e18ffd3383e 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -3836,8 +3836,10 @@ static int walk_pud_range(p4d_t *p4d, unsigned long start, unsigned long end,
> >
> > /* Skip a subtree that had nothing young for this lruvec last gen */
> > if (!walk->force_scan &&
> > - !test_bloom_filter(mm_state, BLOOM_FILTER_PUD, walk->seq, pud_key))
> > + !test_bloom_filter(mm_state, BLOOM_FILTER_PUD, walk->seq, pud_key)) {
> > + walk->mm_stats[MM_PUD_EMPTY_SKIPPED]++;
> > continue;
> > + }
> >
> > if (walk_pmd_range(pud + i, addr, next, args))
> > update_bloom_filter(mm_state, BLOOM_FILTER_PUD, walk->seq + 1,
>
> [Severity: Medium]
> Can walk_pmd_range() drop the true return value from a flushed THP batch
> and leave BLOOM_FILTER_PUD unset for a PUD containing young THP entries?
>
> When walk_pmd_range() encounters a PMD-mapped THP, walk_pmd_range_locked()
> batches it into first/bitmap and initially returns false. If a young
> non-leaf PMD appears more than MIN_LRU_BATCH entries past first, the second
> walk_pmd_range_locked() call flushes that queued batch and discards its
> return value:
>
> mm/vmscan.c:walk_pmd_range() {
> ...
> if (!walk->force_scan && should_clear_pmd_young() &&
> !mm_has_notifiers(args->mm)) {
> if (!pmd_young(val))
> continue;
>
> walk_pmd_range_locked(pud, addr, vma, args, bitmap, &first);
This has been reported at patch 3 sashiko report, a repeatedly reported
issue. Will fix in v6 soon. Thanks.
> }
> ...
> }
>
> Because that flush resets first to -1, the final walk_pmd_range_locked()
> call at the end of walk_pmd_range() returns false. If no subsequent PMD in
> the PUD sets young, walk_pmd_range() returns false to walk_pud_range(),
> which skips update_bloom_filter() for BLOOM_FILTER_PUD and causes the next
> generation's walk to skip the PUD subtree and increment
> MM_PUD_EMPTY_SKIPPED even though it contained young THP entries. OR-ing
> that return value into young avoids losing the result of the flushed batch.
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261123085800.981256-1-baoquan.he@linux.dev?part=4
next prev parent reply other threads:[~2026-11-25 2:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 8:57 [PATCH v5 0/4] skip empty PUD subtrees during aging with a PUD-level Bloom filter Baoquan He
2026-11-23 8:57 ` [PATCH v5 1/4] mm/mglru: add MM_WALK_EMPTY stats and tracepoint Baoquan He
2026-11-23 8:57 ` [PATCH v5 2/4] mm/mglru: add PUD-level Bloom filter state and generic helpers Baoquan He
2026-11-23 8:57 ` [PATCH v5 3/4] mm/mglru: skip cold PUD subtrees during aging Baoquan He
2026-11-23 17:59 ` Lorenzo Stoakes (ARM)
2026-11-24 6:45 ` Baoquan He
2026-11-24 8:59 ` sashiko-bot
2026-11-25 2:20 ` Baoquan He
2026-11-23 8:58 ` [PATCH v5 4/4] mm/mglru: count PUD subtrees skipped by the PUD-level filter Baoquan He
2026-11-24 8:59 ` sashiko-bot
2026-11-25 2:22 ` Baoquan He [this message]
2026-11-23 17:57 ` [PATCH v5 0/4] skip empty PUD subtrees during aging with a PUD-level Bloom filter Lorenzo Stoakes (ARM)
2026-11-24 6:29 ` Baoquan He
2026-11-24 9:44 ` Lorenzo Stoakes (ARM)
2026-11-24 10:10 ` Baoquan He
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=awZGgSrYIuOFoLwZ@bogon \
--to=baoquan.he@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=hebaoquan@kylinos.cn \
--cc=kasong@tencent.com \
--cc=linux-mm@kvack.org \
--cc=qi.zheng@linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=weixugc@google.com \
--cc=yuanchu@google.com \
/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.