From: Kairui Song via B4 Relay <devnull+kasong.tencent.com@kernel.org>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Barry Song <baohua@kernel.org>,
Axel Rasmussen <axelrasmussen@google.com>,
Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.com>,
Baoquan He <baoquan.he@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
Chris Li <chrisl@kernel.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Ridong Chen <ridong.chen@linux.dev>,
Lian Wang <lianux.mm@gmail.com>, Yu Zhao <yuzhao@google.com>,
Zi Yan <ziy@nvidia.com>, Qi Zheng <qi.zheng@linux.dev>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Kairui Song <ryncsn@gmail.com>, Kairui Song <kasong@tencent.com>
Subject: [PATCH v4 0/6] mm/mglru: clean up folio counters and flag usage
Date: Mon, 31 Aug 2026 02:43:30 +0800 [thread overview]
Message-ID: <20260831-mglru-flags-cleanup-v4-0-2d15dde0d7ee@tencent.com> (raw)
This is a cleanup series separated out from the MGLRU-FG series [1]. As
that series is getting too long in following updates, seperate out the
clean up part for easier review and merge.
No feature change is intended, except one bugfix. It mostly replaces
the open-coded bit operations scattered throughout the MGLRU code with
new helpers, with proper kdocs, sanity debug checks, and hardens a few
MGLRU functions.
A subtle generation counter leak is also found during the refactoring
and the fix is included.
Also collected review feedbacks on the cleanup part from the posted
series.
Link: https://lore.kernel.org/linux-mm/20260804-mglru-fg-v1-0-4d8dad39dad6@tencent.com/ [1]
Signed-off-by: Kairui Song <kasong@tencent.com>
---
Changes in v4:
- Rename lru_gen_set_flags/lru_gen_from_flags to
lru_set_gen_flags/lru_get_gen_flags, similiar with lru refs helpers,
as suggested by [ Barry Song ].
- Added some comments to cover concerned raised by [ Barry Song ] and [
Baolin Wang ].
- A little code shuffling and better sanity check for concerns raised by
[ Ridong Chen ].
- Collect tags.
- Link to v3: https://patch.msgid.link/20260826-mglru-flags-cleanup-v3-0-d9f1c75549c8@tencent.com
Changes in v3:
- Set PG_workingset before setting LRU refs bit to avoid any potential
under report of folio tier.
- Migrate folio's referenced status before PG_update so lockless readers
won't set stale referenced status.
- Link to v2: https://patch.msgid.link/20260824-mglru-flags-cleanup-v2-0-0104132114ae@tencent.com
Changes in v2:
- Dropped the redundant LRU_GEN_MAX macro.
- Renamed folio_migrate_refs() to folio_migrate_lru_refs() and reworded
its commit message to describe the referenced state being transferred.
- Rewrote patch 6's commit message with a detailed analysis of the
anon/file accounting race.
- Dropped patch 7, it doesn't really fix anything, and might be in
conflict with other updating series.
- Collected Reviewed-by tags.
- Link to v1: https://patch.msgid.link/20260818-mglru-flags-cleanup-v1-0-8dbbdac0d28c@tencent.com
---
Kairui Song (6):
mm/memcontrol: make lru_zone_size atomic and simplify sanity check
mm/mglru: introduce helpers for manipulating gen and refs flags
mm/migrate: copy all referenced state via folio_migrate_lru_refs
mm/mglru: move max_seq read into walk_update_folio
mm/mglru: use explicit tier range in read_ctrl_pos()
mm/mglru: fix potential generation folio number leak
include/linux/memcontrol.h | 9 +++-
include/linux/mm_inline.h | 111 ++++++++++++++++++++++++++++++++++++------
include/linux/mmzone.h | 3 ++
mm/folio.c | 19 ++++----
mm/memcontrol.c | 18 +------
mm/migrate.c | 6 +--
mm/vmscan.c | 117 +++++++++++++++++++++++----------------------
7 files changed, 183 insertions(+), 100 deletions(-)
---
base-commit: aeddb4d52acfcc5ce5e988acd48f2906fe966ca3
change-id: 20260818-mglru-flags-cleanup-cc49cfad654f
Best regards,
--
Kairui Song <kasong@tencent.com>
next reply other threads:[~2026-08-30 18:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 18:43 Kairui Song via B4 Relay [this message]
2026-08-30 18:43 ` [PATCH v4 1/6] mm/memcontrol: make lru_zone_size atomic and simplify sanity check Kairui Song via B4 Relay
2026-09-01 4:38 ` Shakeel Butt
2026-09-01 5:20 ` Kairui Song
2026-09-01 17:37 ` Shakeel Butt
2026-09-01 18:11 ` Kairui Song
2026-09-01 18:34 ` Shakeel Butt
2026-08-30 18:43 ` [PATCH v4 2/6] mm/mglru: introduce helpers for manipulating gen and refs flags Kairui Song via B4 Relay
2026-09-01 2:05 ` Baolin Wang
2026-09-01 10:32 ` Barry Song
2026-08-30 18:43 ` [PATCH v4 3/6] mm/migrate: copy all referenced state via folio_migrate_lru_refs Kairui Song via B4 Relay
2026-08-30 18:43 ` [PATCH v4 4/6] mm/mglru: move max_seq read into walk_update_folio Kairui Song via B4 Relay
2026-08-30 18:43 ` [PATCH v4 5/6] mm/mglru: use explicit tier range in read_ctrl_pos() Kairui Song via B4 Relay
2026-08-30 18:43 ` [PATCH v4 6/6] mm/mglru: fix potential generation folio number leak Kairui Song via B4 Relay
2026-09-01 10:56 ` Barry Song
2026-09-01 11:13 ` Kairui Song
2026-09-01 11:33 ` Barry Song
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=20260831-mglru-flags-cleanup-v4-0-2d15dde0d7ee@tencent.com \
--to=devnull+kasong.tencent.com@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=cgroups@vger.kernel.org \
--cc=chrisl@kernel.org \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kasong@tencent.com \
--cc=liam@infradead.org \
--cc=lianux.mm@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=qi.zheng@linux.dev \
--cc=ridong.chen@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=ryncsn@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=vbabka@kernel.org \
--cc=weixugc@google.com \
--cc=yuanchu@google.com \
--cc=yuzhao@google.com \
--cc=ziy@nvidia.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