freenode
Kernel & Low-Level

MGLRU RFC adds frequency-guided promotion, claims double-digit gains

Kairui Song’s third RFC series promotes hot pages on access instead of at eviction, reporting 10–40% better results while freeing one page-flag bit.

Kairui Song of Tencent has posted a third RFC series that reworks the Linux Multi-Gen LRU (MGLRU) so hot pages are promoted by access frequency rather than waiting for eviction-time protection. Across kernel builds, servers, desktops, and Android he reports roughly 10% to 40% higher performance or lower refault rates, while cutting MGLRU’s page-flag use by one bit.

MGLRU has long relied on a PID-style controller that protects tiers only when pages are about to leave memory. That feedback loop is slow: hot pages can already be gone before protection arrives, tier resolution collapses once access counts saturate, and eviction-time budgets can shield cold tail pages at the expense of hotter ones still on the list. Workingset tracking for page cache and PSI pressure accounting have also been weak under that model.

The frequency-guided design keeps a compact per-folio reference count in the page flags and promotes once the count crosses defined thresholds, complementing rather than replacing the existing eviction controller. The same count absorbs the old referenced and workingset bits, so accounting is more accurate and one flag bit is reclaimed. Active and inactive sizes exported through vmstat and memcg stats switch from generation-window guesses to per-folio thresholds, removing jumpy drops, under-reported file cache, and the near-random active-anon readings seen on swapless systems.

Classical LRU behavior is left alone. Song describes the series as already usable and stable, but keeps it RFC because it is a major LRU change, including how active and inactive memory are reported. He notes V3 can still over-reclaim anonymous memory in some cases and treats that as a separate follow-up. Documentation for aging and eviction is updated to match the new model.