"CC_OPTIMIZE_FOR_PERFORMANCE_O3" Performance Tunable Dropped In Linux 6.0

Written by Michael Larabel in Linux Kernel on 10 August 2022 at 03:00 PM EDT. 58 Comments
LINUX KERNEL
Following recent upstream discussions around the -O3 compiler optimizations for the Linux kernel, the Kconfig switch advertising this option is being removed in Linux 6.0.

Back in June was a Linux kernel discussion around using -O3 compiler optimizations on the Linux kernel with there existing the "CC_OPTIMIZE_FOR_PERFORMANCE_O3" Kconfig switch that sets the "-O3" compiler flag for the kernel build but was limited to the ARC CPU architecture. There was a proposal to expand that option to be easily used by any CPU architecture for the kernel while clearly marking it as experimental.

From that discussion, Linus Torvalds once gain came out against -O3 optimizing the kernel due to the potential of hard-to-diagnose/reproduce bugs introduced by the compiler optimizations. Other upstream kernel developers also criticized that higher optimization level over the default -O2 level due to the risks, particularly with older compilers and memories from times when -O3 tended to be more buggy.

Additionally, this dedicated Kconfig switch really isn't needed when the same application can be achieved with setting "KCFLAGS=-O3."

So now with the Kbuild updates for Linux 6.0, the CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 is being removed entirely.


Those wishing to better optimize their kernel for performance can still resort to using "KCFLAGS=-O3" though my -O3 Linux kernel build benchmarks from this summer didn't show it to be particularly worthwhile.
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