From: Baoquan He <baoquan.he@linux.dev>
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
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: Tue, 24 Nov 2026 14:45:49 +0800 [thread overview]
Message-ID: <awUyna_r2Iwxu43f@bogon> (raw)
In-Reply-To: <awR-0mcGnK-lM9EP@gremlin>
On 11/23/26 at 05:59pm, Lorenzo Stoakes (ARM) wrote:
> On Mon, Nov 23, 2026 at 04:57:59PM +0800, Baoquan He wrote:
> > diff --git a/mm/rmap.c b/mm/rmap.c
> > index 65646ed6fc45..ea5ada45c09f 100644
> > --- a/mm/rmap.c
> > +++ b/mm/rmap.c
> > @@ -1004,8 +1004,11 @@ static bool folio_referenced_one(struct folio *folio,
> > referenced++;
> > } else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
> > if (pmdp_clear_flush_young_notify(vma, address,
> > - pvmw.pmd))
> > + pvmw.pmd)) {
> > referenced++;
> > + if (lru_gen_enabled() && !lru_gen_switching())
>
> Could this be abstracted a little bette? This looks to be embedding an expression
> specific to lrugen in rmap?
You are right, the "is MGLRU in use" test should be kept inside
lru_gen_mark_pud(), so the rmap side is one plain call and rmap does
not have to carry an MGLRU expression. Will update this in v6. Thanks
for careful reviewing and great suggestion.
@@ -1004,8 +1004,10 @@ static bool folio_referenced_one(struct folio *folio,
referenced++;
} else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
if (pmdp_clear_flush_young_notify(vma, address,
- pvmw.pmd))
+ pvmw.pmd)) {
referenced++;
+ lru_gen_mark_pud(vma->vm_mm, folio, address);
+ }
} else {
/* unexpected pmd-mapped folio? */
WARN_ON_ONCE(1);
......
+void lru_gen_mark_pud(struct mm_struct *mm, struct folio *folio, unsigned long addr)
+{
+ struct mem_cgroup *memcg;
+
+ if (!lru_gen_enabled() || lru_gen_switching())
+ return;
+
+ memcg = get_mem_cgroup_from_folio(folio);
+ lru_gen_update_pud_filter(mem_cgroup_lruvec(memcg, folio_pgdat(folio)),
+ mm, addr);
+ mem_cgroup_put(memcg);
+}
+
>
> > + lru_gen_mark_pud(vma->vm_mm, folio, address);
>
> --
> Cheers, Lorenzo
next prev parent reply other threads:[~2026-11-24 6:46 UTC|newest]
Thread overview: 9+ 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 [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-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
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=awUyna_r2Iwxu43f@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=ljs@kernel.org \
--cc=qi.zheng@linux.dev \
--cc=ryncsn@gmail.com \
--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