Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm/mglru: deactivate anon folios into the oldest generation
@ 2026-11-19 13:47 Ridong Chen
  2026-11-19 13:47 ` [PATCH v2 1/2] mm/mglru: pass a seq range to lru_gen_add_folio() Ridong Chen
  2026-11-19 13:47 ` [PATCH v2 2/2] mm/mglru: deactivate anon folios into the oldest generation Ridong Chen
  0 siblings, 2 replies; 3+ messages in thread
From: Ridong Chen @ 2026-11-19 13:47 UTC (permalink / raw)
  To: Andrew Morton, Kairui Song, David Hildenbrand, Johannes Weiner
  Cc: Barry Song, Qi Zheng, Shakeel Butt, Axel Rasmussen, Yuanchu Xie,
	Wei Xu, Baoquan He, Baolin Wang, Liam R. Howlett, Vlastimil Babka,
	Mike Rapoport, Michal Hocko, Yu Zhao,
	open list:MEMORY MANAGEMENT - MGLRU (MULTI-GEN LRU), Ridong Chen,
	Ridong Chen

From: Ridong Chen <chenridong@xiaomi.com>

With MGLRU, folio_deactivate() puts anon folios that are not in the
swap cache into max_seq - 1, an active generation, so MADV_COLD and
DAMOS_LRU_DEPRIO move them away from eviction instead of towards it.

Patch 1 lets lru_gen_add_folio() take a [min_seq, max_seq] range for the
target generation and renames "reclaiming" to "tail", as Kairui
suggested. No functional change intended.

Patch 2 uses it in lru_deactivate() to add the folio to the head of the
oldest generation, which matches the classic LRU, as Barry suggested.

Changes in v2:
- Add the folio to the head of the oldest generation instead of its
  tail, so file folios keep their old position and anon folios are not
  put ahead of them (Barry).
- Build on top of the scanned_seq change in mm-new and add a seq range
  to lru_gen_add_folio() instead of open coding the move (Kairui).
- Keep the per-cpu batching in folio_deactivate().

Link to v1:
https://lore.kernel.org/linux-mm/20261112081928.3014946-1-ridong.chen@linux.dev/

This series was developed with the help of an AI coding assistant
(Claude).

Ridong Chen (2):
  mm/mglru: pass a seq range to lru_gen_add_folio()
  mm/mglru: deactivate anon folios into the oldest generation

 include/linux/mm_inline.h | 52 +++++++++++++++++----------------------
 mm/folio.c                | 16 +++++++++++-
 mm/vmscan.c               | 11 +++------
 3 files changed, 41 insertions(+), 38 deletions(-)


base-commit: 9f004372ebeb18fdeb699f9880a0e472df90135b
-- 
2.34.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-19 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 13:47 [PATCH v2 0/2] mm/mglru: deactivate anon folios into the oldest generation Ridong Chen
2026-11-19 13:47 ` [PATCH v2 1/2] mm/mglru: pass a seq range to lru_gen_add_folio() Ridong Chen
2026-11-19 13:47 ` [PATCH v2 2/2] mm/mglru: deactivate anon folios into the oldest generation Ridong Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox