v6 2026-09-06

清理 MGLRU folio 计数与标志使用 · v6

MGLRU 清理系列:改进 gen/refs 标志辅助函数、修复合用时引用状态复制与 generation folio 数泄漏。

原始补丁链接

子 Patch(6)

1/6
mm/memcontrol: move the lru_zone_size sanity check to the reader side
From: Kairui Song kasong@tencent.com Instead of using an unsigned long and checking the counter value at the updater side, turn the counter into a signed long and check at the reader side. This red
2/6
mm/mglru: introduce helpers for manipulating gen and refs flags
[mm/mglru: introduce helpers for manipulating gen and refs flags] From: Kairui Song kasong@tencent.com Instead of doing bit ops on folio->flags.f, introduce helpers for adjusting a folio’s refs and
3/6
mm/migrate: copy all referenced state via folio_migrate_lru_refs
From: Kairui Song kasong@tencent.com folio_migrate_flags() copies PG_referenced separately from the MGLRU refs counter, which folio_migrate_refs() transfers. Yet under MGLRU, PG_referenced and the
4/6
mm/mglru: move max_seq read into walk_update_folio
From: Kairui Song kasong@tencent.com walk_pte_range(), walk_pmd_range_locked(), and lru_gen_look_around() each read lrugen->max_seq to compute the target generation used by walk_update_folio(), the
5/6
mm/mglru: use explicit tier range in read_ctrl_pos()
From: Kairui Song kasong@tencent.com read_ctrl_pos() encodes the tier range in a single “tier” parameter via “tier % MAX_NR_TIERS” as the start and “min(tier, MAX_NR_TIERS-1)” as the end. This is h
6/6
mm/mglru: fix potential generation folio number leak
From: Kairui Song kasong@tencent.com Each generation of MGLRU accounts anon and file folio numbers separately, and the page table walker updates each generation’s counters in batch once the walk is