v2
2026-08-28
加速MGLRU老化并修复冷热反转 · v2
v2:加速 MGLRU inc_min_seq() 并修复 cold/hot 反转,包含批量更新 nr_pages 和整理 folio 移动。
原始补丁链接
子 Patch(7)
1/7
mm/mglru: separate folio generation update from LRU accounting
[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 siz
2/7
mm/mglru: batch update lrugen->nr_pages in inc_min_seq()
[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 upda
3/7
mm/mglru: enhance cold/hot inversion handling in inc_min_seq()
[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 co
4/7
mm/mglru: exclude folios promoted by aging from protected in inc_min_seq()
[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:
5/7
mm/mglru: make LRU folio prefetch helper an inline function
[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
6/7
mm/mglru: move folios from oldest gen to second-oldest gen from head to tail
[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,
7/7
mm/mglru: batch move folios to the second-oldest gen's LRU
[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 signific