MGLRU RFC adds frequency-guided promotion, claims 10-40% gains
Kairui Song's series promotes hot folios on access, fixes PSI and workingset tracking, and stabilizes active/inactive stats while freeing one page flag bit.
An RFC posted to the Linux kernel mailing list proposes frequency-guided promotion for Multi-Gen LRU (MGLRU), reporting 10% to 40% higher performance or lower page refaults on mixed workloads while cutting MGLRU's page-flag use by one bit.
Kairui Song of Tencent sent the second RFC version, following an idea raised at LSF/MM/BPF and retested on current mm development trees. The series keeps MGLRU's eviction-time tier and PID protection, and adds proactive promotion driven by how often a folio is accessed. Accesses feed a compact referenced count held in folio flags; when that count crosses defined thresholds the folio is promoted instead of waiting for reclaim feedback.
The older tier-only model had a long feedback loop: protection arrived only after enough refaults, often after hot pages were already gone. Tier resolution was coarse, and once the reference bits saturated, hotter pages could no longer be distinguished. PID protection also activated at the LRU tail, so cold tail pages could consume the protection budget while hotter head pages lost it. Song says the change mainly improves LRU's ability to keep the hotter working set, not just micro-optimizations around the edges.
Secondary fixes target long-standing accounting gaps. Pressure Stall Information (PSI) and workingset tracking, especially for page cache, were under-counted or unreliable under MGLRU. Active and inactive sizes exported through vmstat and memory cgroup stats used to be derived from generation windows: unmapped file pages stuck on old generations under-reported active file cache, aging caused sudden jumps, and swapless machines saw active anon oscillate into meaningless values. With per-folio reference counts, a folio counts as active once its refs reach a protection threshold. The numbers become smoother and closer to classical LRU, and memcg reparenting no longer needs special size fixups.
In a kernel build under a 3G memory cgroup, the patched tree beat both mainline MGLRU and classical LRU on wall time, CPU time, swap traffic, and file and anon refaults across swappiness settings, on disk swap and on zram. Song reports similar gains on servers of several architectures, desktops, and Android, with no regressions observed. Classical LRU behavior is left unchanged.
Song is keeping the work as an RFC because it is a major LRU change, including how active and inactive are defined, even though the series is described as already usable and stable. Smaller helper pieces from the first version have already landed; this posting shows the full design.