Microsoft Is Exploring LTO+PGO For A Faster Linux Kernel

Written by Michael Larabel in Microsoft on 27 August 2020 at 10:04 AM EDT. 41 Comments
MICROSOFT
While more and more software vendors are employing link-time optimizations (LTO) and profile-guided optimizations (PGO) for leveraging the compiler to squeeze out performance, it may surprise many that Microsoft engineers are exploring LTO+PGO for the Linux kernel in their own quest of achieving greater Linux performance.

Using link-time optimizations on the Linux kernel isn't a new concept with several different vendors over the years having proposed LTO patches for the Linux kernel albeit they don't usually end up with too much movement. In the past Linus Torvalds and others have been unconvinced by LTO'ing the kernel in part due to the poor state of LTO in the past for GCC. But these days with the modern GCC compiler (and Clang), LTO tends to be in great shape with the likes of openSUSE and soon Fedora making use of LTO by default when assembling their distribution packages. There's also been the likes of Clear Linux to take it even further by making use of AutoFDO (Auto feedback directed optimizations) for greater performance of their distribution.

While LTO'ing the Linux kernel isn't a new concept, we haven't heard as much about PGO'ing the kenrel. With profile-guided optimizations relying upon, well, profiles for feeding back into the compiler for assisting its optimization heuristics, it's vital that the profiles be accurate for real-world usage. Given the very diverse workloads seen on Linux and on the wide range of hardwares and drivers, it'd be a huge task generating profiles useful enough for PGO that can be used at large and would help the vast majority of users. Thus for PGO'ing the kernel it's likely on more of a niche basis to individual users/organizations that can employ PGO and cater it to their precise use-cases.

Ian Bearman, a software engineering manager at Microsoft, presented at this week's Linux Plumbers Conference on their exploration of profile guided optimization of the Linux kernel.


Their PGO interest stems from an "internal customer request" over Linux performance. Then again, Microsoft working on optimizing Linux performance isn't much of a surprise these days with another Microsoft engineer having been the one to push the FSGSBASE patches forward and ultimately the one to thank for getting them now into Linux 5.9.


Redis is one of the public examples they have been exploring for benefits from kernel PGO usage.


As of LPC2020, Microsoft continues exploring PGO for the Linux kernel. It is interesting to see that it is acknowledged Microsoft Windows does leverage LTO+PGO extensively themselves. In the Windows instance they reportedly see 5~20% greater performance from these compiler optimizations, presumably with their own MSVC compiler. More details via the slide deck from the Linux Plumbers Conference.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week