From: Andrew Morton <akpm@linux-foundation.org>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: david@kernel.org, catalin.marinas@arm.com, will@kernel.org,
lorenzo.stoakes@oracle.com, ryan.roberts@arm.com,
Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, riel@surriel.com,
harry.yoo@oracle.com, jannh@google.com, willy@infradead.org,
baohua@kernel.org, dev.jain@arm.com, axelrasmussen@google.com,
yuanchu@google.com, weixugc@google.com, hannes@cmpxchg.org,
zhengqi.arch@bytedance.com, shakeel.butt@linux.dev,
linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/6] support batched checking of the young flag for MGLRU
Date: Fri, 6 Mar 2026 15:20:42 -0800 [thread overview]
Message-ID: <20260306152042.8516ec644e95e9a23df30e5f@linux-foundation.org> (raw)
In-Reply-To: <cover.1772778858.git.baolin.wang@linux.alibaba.com>
On Fri, 6 Mar 2026 14:43:36 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:
> This is a follow-up to the previous work [1], to support batched checking
> of the young flag for MGLRU.
>
> Similarly, batched checking of young flag for large folios can improve
> performance during large-folio reclamation when MGLRU is enabled. I
> observed noticeable performance improvements (see patch 5) on an Arm64
> machine that supports contiguous PTEs. All mm-selftests are passed.
Thanks, I updated mm-new with this.
> Changes from v2:
> v2: https://lore.kernel.org/all/cover.1772185080.git.baolin.wang@linux.alibaba.com/
> - Update the commit message of patch 5 (per David).
> - Fix some coding style issues (per David).
> - Remove 'cur_pte' variable in lru_gen_look_around() (per David).
> - Move 'ptes += nr;' to the suitable place in folio_referenced_one() (per David).
> - Add acked tag from David. Thanks.
>
Here's how v3 altered mm.git:
include/linux/pgtable.h | 3 +--
mm/rmap.c | 2 +-
mm/vmscan.c | 11 +++++------
3 files changed, 7 insertions(+), 9 deletions(-)
--- a/include/linux/pgtable.h~b
+++ a/include/linux/pgtable.h
@@ -1124,8 +1124,7 @@ static inline int clear_flush_young_ptes
* Returns: whether any PTE was young.
*/
static inline int test_and_clear_young_ptes(struct vm_area_struct *vma,
- unsigned long addr, pte_t *ptep,
- unsigned int nr)
+ unsigned long addr, pte_t *ptep, unsigned int nr)
{
int young = 0;
--- a/mm/rmap.c~b
+++ a/mm/rmap.c
@@ -964,7 +964,6 @@ static bool folio_referenced_one(struct
pte_t pteval = ptep_get(pvmw.pte);
nr = folio_pte_batch(folio, pvmw.pte, pteval, max_nr);
- ptes += nr;
}
if (lru_gen_enabled() && pvmw.pte) {
@@ -982,6 +981,7 @@ static bool folio_referenced_one(struct
WARN_ON_ONCE(1);
}
+ ptes += nr;
pra->mapcount -= nr;
/*
* If we are sure that we batched the entire folio,
--- a/mm/vmscan.c~b
+++ a/mm/vmscan.c
@@ -4201,7 +4201,6 @@ bool lru_gen_look_around(struct page_vma
struct lruvec *lruvec;
struct lru_gen_mm_state *mm_state;
unsigned long max_seq;
- pte_t *cur_pte;
int gen;
lockdep_assert_held(pvmw->ptl);
@@ -4247,10 +4246,10 @@ bool lru_gen_look_around(struct page_vma
pte -= (addr - start) / PAGE_SIZE;
- for (i = 0, addr = start, cur_pte = pte; addr != end;
- i += nr, cur_pte += nr, addr += nr * PAGE_SIZE) {
+ for (i = 0, addr = start; addr != end;
+ i += nr, pte += nr, addr += nr * PAGE_SIZE) {
unsigned long pfn;
- pte_t ptent = ptep_get(cur_pte);
+ pte_t ptent = ptep_get(pte);
nr = 1;
pfn = get_pte_pfn(ptent, vma, addr, pgdat);
@@ -4264,11 +4263,11 @@ bool lru_gen_look_around(struct page_vma
if (folio_test_large(folio)) {
const unsigned int max_nr = (end - addr) >> PAGE_SHIFT;
- nr = folio_pte_batch_flags(folio, NULL, cur_pte, &ptent,
+ nr = folio_pte_batch_flags(folio, NULL, pte, &ptent,
max_nr, FPB_MERGE_YOUNG_DIRTY);
}
- if (!test_and_clear_young_ptes_notify(vma, addr, cur_pte, nr))
+ if (!test_and_clear_young_ptes_notify(vma, addr, pte, nr))
continue;
if (last != folio) {
_
next prev parent reply other threads:[~2026-03-06 23:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 6:43 [PATCH v3 0/6] support batched checking of the young flag for MGLRU Baolin Wang
2026-03-06 6:43 ` [PATCH v3 1/6] mm: use inline helper functions instead of ugly macros Baolin Wang
2026-03-06 6:43 ` [PATCH v3 2/6] mm: rename ptep/pmdp_clear_young_notify() to ptep/pmdp_test_and_clear_young_notify() Baolin Wang
2026-03-06 6:43 ` [PATCH v3 3/6] mm: rmap: add a ZONE_DEVICE folio warning in folio_referenced() Baolin Wang
2026-03-06 6:43 ` [PATCH v3 4/6] mm: add a batched helper to clear the young flag for large folios Baolin Wang
2026-03-06 6:43 ` [PATCH v3 5/6] mm: support batched checking of the young flag for MGLRU Baolin Wang
2026-03-06 14:44 ` David Hildenbrand (Arm)
2026-03-06 6:43 ` [PATCH v3 6/6] arm64: mm: implement the architecture-specific test_and_clear_young_ptes() Baolin Wang
2026-03-06 14:47 ` David Hildenbrand (Arm)
2026-03-07 1:28 ` Baolin Wang
2026-03-09 14:39 ` David Hildenbrand (Arm)
2026-03-10 2:51 ` Baolin Wang
2026-03-09 14:40 ` David Hildenbrand (Arm)
2026-03-06 23:20 ` Andrew Morton [this message]
2026-03-07 1:29 ` [PATCH v3 0/6] support batched checking of the young flag for MGLRU Baolin Wang
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=20260306152042.8516ec644e95e9a23df30e5f@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Liam.Howlett@oracle.com \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=hannes@cmpxchg.org \
--cc=harry.yoo@oracle.com \
--cc=jannh@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=riel@surriel.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=weixugc@google.com \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=yuanchu@google.com \
--cc=zhengqi.arch@bytedance.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.