From: sashiko-bot@kernel.org
To: "Baoquan He" <baoquan.he@linux.dev>, linux-mm@kvack.org
Cc: akpm@linux-foundation.org, david@kernel.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>,
"Kairui Song" <ryncsn@gmail.com>
Subject: Re: [PATCH 3/4] mm/mglru: skip cold PUD subtrees during aging
Date: Sat, 21 Nov 2026 08:59:03 +0000 [thread overview]
Message-ID: <sashiko-outbox-226850@kernel.org> (raw)
In-Reply-To: <20261120085806.781225-4-baoquan.he@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mm/mglru: walk_pmd_range() drops young status of THPs flushed
at non-leaf PMD
--
commit 807f1bc14298f872f3bf880156eb7f9c34a7f570
Author: Baoquan He <hebaoquan@kylinos.cn>
mm/mglru: skip cold PUD subtrees during aging
This commit introduces a PUD-level Bloom filter to MGLRU page table aging
to skip 1 GiB PUD subtrees that had no young pages in the previous
generation, while updating the filter from the page table walk and rmap
feedback paths.
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index a4c64a1903912..2cd3f28f74288 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
[ ... ]
> @@ -3626,11 +3637,12 @@ static bool walk_pte_range(pmd_t *pmd, unsigned long start, unsigned long end,
> return suitable_to_scan(total, young);
> }
>
> -static void walk_pmd_range_locked(pud_t *pud, unsigned long addr, struct vm_area_struct *vma,
> +static bool walk_pmd_range_locked(pud_t *pud, unsigned long addr, struct vm_area_struct *vma,
> struct mm_walk *args, unsigned long *bitmap, unsigned long *first)
> {
> int i;
> bool dirty;
> + bool young = false;
> pmd_t *pmd;
> spinlock_t *ptl;
> struct folio *last = NULL;
> @@ -3644,13 +3656,13 @@ static void walk_pmd_range_locked(pud_t *pud, unsigned long addr, struct vm_area
> if (*first == -1) {
> *first = addr;
> bitmap_zero(bitmap, MIN_LRU_BATCH);
> - return;
> + return false;
> }
>
> i = addr == -1 ? 0 : pmd_index(addr) - pmd_index(*first);
> if (i && i <= MIN_LRU_BATCH) {
> __set_bit(i - 1, bitmap);
> - return;
> + return false;
> }
[ ... ]
> @@ -3755,7 +3771,8 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,
> walk->mm_stats[MM_LEAF_TOTAL]++;
>
> if (pfn != -1)
> - walk_pmd_range_locked(pud, addr, vma, args, bitmap, &first);
> + young |= walk_pmd_range_locked(pud, addr, vma, args,
> + bitmap, &first);
> continue;
> }
>
> @@ -3777,15 +3794,18 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,
> continue;
>
> walk->mm_stats[MM_NONLEAF_ADDED]++;
> + young = true;
>
> /* carry over to the next generation */
> update_bloom_filter(mm_state, BLOOM_FILTER_PMD, walk->seq + 1, pmd + i);
> }
>
> - walk_pmd_range_locked(pud, -1, vma, args, bitmap, &first);
> + young |= walk_pmd_range_locked(pud, -1, vma, args, bitmap, &first);
[Severity: Medium]
Can walk_pmd_range() drop the young return value when batched transparent
huge pages are flushed at a non-leaf PMD?
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);
}
...
}
walk_pmd_range_locked() buffers up to 1 + MIN_LRU_BATCH entries in first
and bitmap across loop iterations, returning false while buffering. If
earlier iterations queued PMD-mapped THPs and this non-leaf PMD call lies
more than MIN_LRU_BATCH entries past first, it flushes those THPs and
resets first to -1, but its return value is ignored. If no later PMD in
the PUD sets young, walk_pmd_range() returns false and walk_pud_range()
leaves the PUD out of BLOOM_FILTER_PUD, skipping the 1 GiB subtree on the
next aging pass.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120085806.781225-1-baoquan.he@linux.dev?part=3
next prev parent reply other threads:[~2026-11-21 8:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 8:58 [PATCH 0/4] skip empty PUD subtrees during aging with a PUD-level Bloom filter Baoquan He
2026-11-20 8:58 ` [PATCH 1/4] mm/mglru: add MM_WALK_EMPTY stats and tracepoint Baoquan He
2026-11-21 8:59 ` sashiko-bot
2026-11-20 8:58 ` [PATCH 2/4] mm/mglru: add PUD-level Bloom filter state and generic helpers Baoquan He
2026-11-20 8:58 ` [PATCH 3/4] mm/mglru: skip cold PUD subtrees during aging Baoquan He
2026-11-21 8:59 ` sashiko-bot [this message]
2026-11-20 8:58 ` [PATCH 4/4] mm/mglru: count PUD subtrees skipped by the PUD-level filter 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=sashiko-outbox-226850@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=baoquan.he@linux.dev \
--cc=david@kernel.org \
--cc=hebaoquan@kylinos.cn \
--cc=kasong@tencent.com \
--cc=linux-mm@kvack.org \
--cc=qi.zheng@linux.dev \
--cc=ryncsn@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox