Linux 6.16 Adds "X86_NATIVE_CPU" Option To Optimize Your Kernel Build For Your CPU
([Linux Kernel] 5 Hours Ago
CONFIG_X86_NATIVE_CPU)
- Reference: 0001549222
- News link: https://www.phoronix.com/news/Linux-6.16-X86_NATIVE_CPU
- Source link:
The X86_NATIVE_CPU Kconfig build time option has been merged for the Linux 6.16 merge window as an easy means of enforcing "-march=native" compiler behavior on AMD and Intel processors to optimize your kernel build for the local CPU architecture/family of your system.
For those wanting to "-march=native" your Linux kernel build on AMD/Intel x86_64 processors, the new CONFIG_X86_NATIVE_CPU option can be easily enabled for setting that compiler option on your local kernel builds.
The CONFIG_X86_NATIVE_CPU option is honored if compiling the Linux x86_64 kernel with GCC or LLVM Clang when using Clang 19 or newer due to a compiler bug with the Linux kernel on older compiler versions.
In addition to setting the "-march=native" compiler option for the Linux kernel C code, enabling this new Kconfig build option also sets "-Ctarget-cpu=native" for the kernel's Rust code too.
This new option was merged as part of the [1]x86/build updates for Linux 6.16. No performance benchmarks were provided as part of the patch message but I'll be firing up some CONFIG_X86_NATIVE_CPU benchmarks as time allows.
[1] https://lore.kernel.org/lkml/aDL66Kw0auSQQrs-@gmail.com/
For those wanting to "-march=native" your Linux kernel build on AMD/Intel x86_64 processors, the new CONFIG_X86_NATIVE_CPU option can be easily enabled for setting that compiler option on your local kernel builds.
The CONFIG_X86_NATIVE_CPU option is honored if compiling the Linux x86_64 kernel with GCC or LLVM Clang when using Clang 19 or newer due to a compiler bug with the Linux kernel on older compiler versions.
In addition to setting the "-march=native" compiler option for the Linux kernel C code, enabling this new Kconfig build option also sets "-Ctarget-cpu=native" for the kernel's Rust code too.
This new option was merged as part of the [1]x86/build updates for Linux 6.16. No performance benchmarks were provided as part of the patch message but I'll be firing up some CONFIG_X86_NATIVE_CPU benchmarks as time allows.
[1] https://lore.kernel.org/lkml/aDL66Kw0auSQQrs-@gmail.com/
Anux