Link-Time Optimizations Near Reality For x86 Linux Kernel

Back in 2012 I wrote about link-time optimizations to speed-up the Linux kernel. Link-Time Optimizations via GCC and other compilers allow for various compile-time optimizations to be applied across the binary as a whole. Enabling link-time optimizations can yield some significant performance improvements but results in much slower compile times and with large programs can cause problems due to the size of optimizing the complete binary at once.
The work back in 2012 by Intel developers showed the kernel compile time increased by two to four times and needed 4~9GB of memory to complete the task. However, it was found the resulting Linux kernel image was faster in various benchmarks. The work in 2012 required a modern version of GCC along with Linux kernel LTO patches and patches to binutils. That work is finally becoming a reality in mainline.
Peter Anvin sent in a bunch of x86 infrastructure work on Monday that prepares for link-time optimization support by the kernel.
Peter wrote in the commit, "My understanding is that the changes to support LTO are still not upstream in binutils, but are on the way there. This patchset should conclude the x86-specific changes, and remaining patches to actually enable LTO will be fed through the Kbuild tree (other than keeping up with changes to the x86 code base, of course), although not necessarily in this merge window."
Hopefully the Linux kernel LTO support will finish up in the Linux 3.15 kernel otherwise Linux 3.16 so we can move onward with some benchmarks of an LTO-optimized Linux kernel to see the performance wins at the cost of greater compile times and memory usage during the compilation process. It's worth noting that with the upcoming GCC 4.9 are also some significant link-time optimization enhancements.
13 Comments