Squeezing More Performance Out Of The Linux Kernel With Clang + LTO
Similar tests were carried out on the Intel Core i9 11900K desktop as well...
The outcome was similar with workloads like LevelDB and other I/O generally benefiting from the Clang-built kernel and more so with LTO enabled. Graphics tests and other areas tended to have no significant difference.
The Stress-NG context switching performance for the Clang-built kernel also remained much higher, similar to the Ryzen 9 testing, for this synthetic test.
The Clang-built kernel also faired better in the Schbench scheduler benchmark.
When looking at the performance difference in the workloads with a measurable difference between tested kernels, the Linux kernel build with Clang and leveraging LTO led to around 9% higher performance on this Core i9 11900K desktop with Linux 5.14-rc1 sources.
Long story short, the LLVM Clang kernel build with LTO tended to see the most benefit in some I/O workloads. Using Clang rather than GCC to compile the Linux kernel in general yielded some performance wins and in worst case scenario delivered performance parity to the GNU Compiler Collection with no instances of finding measurably subpar performance at least from the tests done so far om Ryzen 9 and Core i9 desktops. The LLVM Clang support around building the mainline Linux kernel has matured quite nicely over the course of the past number of kernel releases. Besides performance, there is also the ability of having better security with the Clang-built kernel such as the Control Flow Integrity (CFI) support with the mainline kernel as of Linux 5.13. Also in the performance department is the Profile Guided Optimization (PGO) support for Clang kernel builds that didn't land for Linux 5.14 but looks like it will be buttoned up soon once addressing upstream developer concerns. Google among other vendors continues using Clang-based Linux kernel builds in production.
If you enjoyed this article consider joining Phoronix Premium to view this site ad-free, multi-page articles on a single page, and other benefits. PayPal or Stripe tips are also graciously accepted. Thanks for your support.