Don't Look For Gentoo's CPU Optimization Options To Land In The Mainline Linux Kernel

Written by Michael Larabel in Operating Systems on 23 February 2019 at 11:04 AM EST. 48 Comments
OPERATING SYSTEMS
Gentoo's Linux kernel build has long offered various CPU options in allowing those building their distribution to optimize their kernel build to the CPU being used. Every so often the patch is suggested for upstreaming to the mainline Linux kernel before being quickly rejected by the upstream maintainers.

This week the kernel CPU options patch was suggested for mainlining in the Linux kernel. The patch adds extra CPU options to the kernel configuration (Kconfig) area for adjusting the GCC optimization values for various generations of Intel/AMD CPUs. It allows building the kernel ranging from -march=k8-sse3 to -march=cannonlake, among other prominent generations of Intel/AMD processors over the years.

While the patch is just about adjusting the kernel build's march/mtune parameters, the Gentoo patch maintainer's testing points out "there are small but real speed increases to running with this patch."


However, these sorts of patches never end up getting mainlined. As was the case this week, it was quickly shot down while referencing past objections. Those objections come down to the belief that the compiler optimization benefit for the kernel is miniscule, concerns over how maintainable this code is, the possibility of the compiler tuning introducing regressions, and GCC compiler changes could end up hurting the performance.

There has been talk of offering more generic Kconfig tunables about just optimizing for "modern" Intel/AMD CPUs rather than a bunch of per-generation configuration options, but so far such global knobs haven't been introduced.
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