Clang PGO Shot Down For Now From The Linux Kernel

Written by Michael Larabel in LLVM on 1 July 2021 at 06:13 AM EDT. 29 Comments
While Clang PGO support was sent in for Linux 5.14 as part of Clang compiler handling updates for this next kernel version, the functionality was subsequently dropped out and a new pull request issued after criticism from Linus Torvalds and others.

While Google and others have already been using this Clang profile guided optimization support for the Linux kernel to build workload-optimized kernels, there were questions and criticisms raised over it that led to the pull request being re-submitted without the PGO bits in place.

Linus Torvalds questioned its profiling approach with relying on LLVM/Clang instrumentation rather than focusing on being able to collect the profile/sampling using the kernel's existing perf subsystem. The Clang tooling though appears to be more universal and in better standing at the moment. In particular with going the perf route, only with Intel CPUs are the hardware performance counters handling in very good shape. With AMD Zen 3 processors the performance counters support is in better shape, but this otherwise would pose a problem for those on non-Intel systems wanting to build a PGO-optimized kernel if using perf for sampling. There is also a lack of good perf profiling support at the moment on ARM.

Ultimately though Linus is more in favor of using the kernel's perf infrastructure rather than the LLVM instrumentation and then converting that perf data into a usable format for Clang. Concerns were also raised by others about how much of this kernel PGO infrastructure would be portable to other compilers and the speed of the kernel in its debug/profiling mode when collecting said profiles.

Thus at least for now the Clang updates pulled into Linux 5.14 were re-sent and already merged without the PGO support in place.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of 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 automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week