v3 2026-09-02

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

v3 批处理更新 lrugen->nr_pages 并移动 folio 到次旧代,加速 inc_min_seq() 且修复冷热反转。

原始补丁链接

子 Patch(7)

1/7
mm/mglru: separate folio generation update from LRU accounting
folio_inc_gen() currently updates both the folio’s generation and the LRU size accounting. This makes it difficult to batch the LRU size updates when moving multiple folios. Extract the generation up
2/7
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
3/7
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/7
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 Reviewed-by: Baoquan He <baoquan.he@
5/7
mm/mglru: make LRU folio prefetch helper an inline function
prefetchw_prev_lru_folio() is currently implemented as a macro with a potentially unused argument. This makes the helper harder to read and can also trigger checkpatch warnings about unused macro ar
6/7
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,
7/7
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