"MGLRU" Code Updated For More Performant Linux Page Reclamation
While not coming as part of the new 5.16 cycle, one of the exciting patch series to come about this year has been Google's work on the Multigenerational LRU (MGLRU) Framework for improving performance around the kernel's page reclaim handling.
This low-level feature work for the Linux kernel aims to address the kernel's page reclaim implementation being too expensive on the CPU and sometimes making poor choices over what to evict. Earlier versions of the multigen least-recently-used code from Google has shown fewer low-memory kills on Android and reducing cold starts up ~16%. On Chrome OS they also found this code to be very beneficial with upwards of 59% fewer OOM kills and 96% fewer low-memory tab discards within the browser. Their testing from mobile to servers found lower CPU usage and better system handling under memory pressure.
Google engineers have continued working on the code with promising results for battling Linux's expensive page reclamation. Recently the v4 patches were posted and quickly followed up by v5 that re-based the code against the Linux 5.15 state.
While many of Google's numbers around multigen LRU has been in regards to laptops on Chrome OS and smartphones with Android, recently published were some MariaDB numbers with these patches. "With the MGLRU, MariaDB achieved 95% CIs [5.24, 10.71]% and [20.22, 25.97]% more transactions per minute (TPM), respectively, under the
medium- and high-concurrency conditions when slightly overcommitting memory. There were no statistically significant changes in TPM under other conditions."
The v5 patches that can be applied against Linux 5.15 can be found on the kernel mailing list if wanting to give MGLRU a whirl or wanting to read up on all of the technical details. Hopefully MGLRU will make it into the mainline kernel in 2022.