Linux's Multi-Gen LRU "MGLRU" has already achieved nice performance gains for Linux in recent years by optimizing page reclaims and improves performance under memory pressure. The new MGLRU-FG patches aim to take things further. Linux developer Kairui Song sent out the latest patches this weekend for MGLRU-FG, which is frequency guided promotion for MGLRU. With these latest patches, the Linux kernel build benchmark is performing even better now and all-around delivering nice results. Song explains of the frequency-guided promotion to MGLRU in this patch: "Complement MGLRU's eviction-time tier-PID protection with access-time frequency-guided promotion. Introduce a unified set of helpers built based on referenced (access) count of a folio. Each access increments a folio's referenced count stored in folio flags (refs), refs still maps to a logarithmic tier just like before, but with more formal bit definitions, a few special thresholds are introduced: LRU_REFS_REFERENCED (1), LRU_REFS_WORKINGSET (2), LRU_REFS_PROTECTED (3), and LRU_REFS_MAX (7). When refs reaches a certain threshold, the folio is promoted proactively instead of waiting for the PID controller to kick in. Also simplify MGLRU's usage of PG_workingset and PG_referenced: they become the low two bits of the refs count, with the higher bits provided by LRU_REFS_MASK. This reduces MGLRU's original refs count bit usage by one, since only one extra bit is now needed to record a max referenced count of 7, and makes MGLRU's refs accounting more accurate." For end users what's important and most notable is the end result: "In summary, we can see a 10% - 40% higher performance or lower refault in various different tests, certain workload gets a dramatically reduce of runtime, while reducing the page flags usage by 1 bit. The gain here is mostly from real improvement of LRU's ability to distinguish the hotter workingset. Tested across multiple servers of different archs, desktops, and Android, all shows very promising results. Compared to V2, V3 is more effected by anon over-reclaim, but provides over-all better results, that is a problem that should be fixed later or seperately. It's already very usable, stable, and performing well, but I'll keep it RFC as this is a major change to LRU, including changing the Active/Inactive reading, in a good way I think." The Linux kernel build test is about one second faster or almost 10 seconds faster when compiling with 96 jobs to increase memory reclaim pressure. MongoDB was 13.5% faster with MGLRU-FG. The Chromium and Node.js test using zRAM as swap saw a 76% improvement. FIO was seeing up to 11% higher throughput. More details on this MGLRU-FG work for the Linux kernel can be found via this LKML patch series.
MGLRU-FG Delivering Up To 10~40% Higher Performance For Linux In Some Tests
Full Article
Original Source
Read the full article at Phoronix →KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.