Don't Look For Gentoo's CPU Optimization Options To Land In The Mainline Linux Kernel
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.
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.
48 Comments