v3
2026-07-31
修复MGLRU swappiness行为 · v3
MGLRU 系列:修复 min_seq 指向空代、扫描两个可回收代、改进隔离与耗尽检测并增强老化触发。
原始补丁链接
子 Patch(6)
1/6
mm: mglru: prevent min_seq[type] from pointing to an empty generation
移除 try_to_inc_min_seq() 中调整 min_seq 指向空世代的逻辑,避免 scan_folios() 重复扫描空世代及 aging 误判;reclaim 不会使世代数低于 MIN_NR_GENS。
2/6
mm: mglru: let scan_folios() scan both reclaimable generations
修改 scan_folios(),当最老世代耗尽且第二老世代仍有可回收 folios 时继续扫描,而不是返回,避免该世代在当前 sc->priority 失去回收机会。
3/6
mm/mglru: improve readability of isolate_folios()
重构 isolate_folios() 中的循环,移除误导性的 for_each_evictable_type();明确 get_type_to_scan() 选择扫描类型,i 仅限制尝试次数,提升可读性。
4/6
mm: mglru: improve scan_folios() exhaustion detection
为 scan_folios() 增加 exhausted 输出参数,显式报告当前 type 的可回收列表是否耗尽,修复仅凭 scanned==0 判断耗尽不足的问题。
5/6
mm: mglru: run aging when pages are severely imbalanced across gens
在世代间严重不均衡时触发 aging,恢复 Yu Zhao 原始条件但更严格:年轻世代数量需达年老世代 old_ratio 倍(随 lruvec 增大),且仅用于非平衡 swappiness。
6/6
mm: mglru: run aging if the preferred type has no folios in reclaimable gens
On Fri, Jul 31, 2026 at 3:27 PM Baolin Wang baolin.wang@linux.alibaba.com wrote: > > > > On 7/26/26 8:21 PM, Barry Song (Xiaomi) wrote: > > Respect the type selected by positive_ctrl_err(). If there