Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
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>,
	Kairui Song <ryncsn@gmail.com>
Subject: Re: [PATCH v5 3/4] mm/mglru: skip cold PUD subtrees during aging
Date: Wed, 25 Nov 2026 10:20:57 +0800	[thread overview]
Message-ID: <awZGCeFosH5myoXM@bogon> (raw)
In-Reply-To: <sashiko-outbox-230766@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 status in walk_pmd_range() when flushing
>   THP batch
> --
> 
> commit a67d5ce39733f49dd06a525e19b6621ddfe22558
> Author: Baoquan He <hebaoquan@kylinos.cn>
> 
> mm/mglru: skip cold PUD subtrees during aging
> 
> This commit introduces a PUD-level Bloom filter keyed by (mm, PUD-aligned
> address) to skip PUD subtrees that held no young entries during the previous
> MGLRU aging generation, and updates it from both the page table aging walk and
> the rmap feedback path.
> 
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 7d20ee1b6c10a..517f5fbecdbf7 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> [ ... ]
> > @@ -3750,7 +3766,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;
> >  		}
> 
> [Severity: Medium]
> Does walk_pmd_range() lose the young return value when a queued THP batch
> is flushed by the second walk_pmd_range_locked() call on 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);

Yes, this is a corner case and could happen to lose the PMD-mapped young
leaf count. The detailed analysis has been replied to v4 patch 3:

https://lore.kernel.org/all/awVGycKHzXzW5OF1@bogon/T/#u

This will be fixed in v6.


> 		}
>     ...
> }
> 
> Both PMD-mapped THPs and young non-leaf PMDs share the same (first, bitmap)
> batch.  walk_pmd_range_locked() queues entries within MIN_LRU_BATCH of
> *first and returns false, only scanning the queued entries and returning
> whether any THP was young when a later call exceeds MIN_LRU_BATCH (or passes
> addr == -1).  If a young THP is queued first and a young non-leaf PMD more
> than MIN_LRU_BATCH entries later flushes that batch, the non-leaf call
> discards the return value; 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 for the next generation.
> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20261123085800.981256-1-baoquan.he@linux.dev?part=3


  reply	other threads:[~2026-11-25  2:21 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 [this message]
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
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=awZGCeFosH5myoXM@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=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