v1 2026-08-27

加速MGLRU老化并修复冷热反转 · v1

MGLRU 老化提速:批量处理或跳过 inc_min_seq 操作,修复 promoted folio 与非 promoted folio 冷热顺序颠倒及受保护 folio 计数问题。

原始补丁链接

子 Patch(6)

1/6
mm/mglru: batch update lrugen->nr_pages in inc_min_seq()
Currently, folio_inc_gen() updates lrugen->nr_pages for every folio as it advances generations. Instead, accumulate the size changes and update lrugen->nr_pages in a batch after scanning the entire ol
2/6
mm/mglru: batch update lrugen->protected in inc_min_seq()
Avoid updating lrugen->protected with WRITE_ONCE() for each folio, which may prevent potential compiler optimizations. Accumulate the updates locally and apply them in a batch instead. Signed-off-by:
3/6
mm/mglru: enhance cold/hot inversion handling in inc_min_seq()
During aging, a folio’s generation may already have been updated by folio_update_gen(), even though it has not yet been moved to the corresponding generation list. Such folios are hotter than those al
4/6
mm/mglru: exclude folios promoted by aging from protected in inc_min_seq()
Some folios may have been promoted during aging, so don’t count them as protected, similar to sort_folio(). Signed-off-by: Barry Song (Xiaomi) baohua@kernel.org — mm/vmscan.c | 13 ++++++——-
5/6
mm/mglru: move folios from oldest gen to second-oldest gen from head to tail
For reclamation, it makes sense to reclaim folios from tail to head, as folios near the head are relatively hot. However, when moving folios from the oldest generation to the second-oldest generation,
6/6
mm/mglru: batch move folios to the second-oldest gen's LRU
Detect folios that need to move from the oldest generation to the second-oldest generation, and batch-move them together. This can significantly reduce the sys time of inc_min_seq(), especially when t