Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
Build Linux

Linux 6.16 Adds 'X86_NATIVE_CPU' Option To Optimize Your Kernel Build (phoronix.com) 33

unixbhaskar shares a report from Phoronix: 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.
"It seems interesting though," comments unixbhaskar. "If the detailed benchmark shows some improvement with the option selected, then distros might start to adopt it for their flavor."

Linux 6.16 Adds 'X86_NATIVE_CPU' Option To Optimize Your Kernel Build

Comments Filter:
  • To some degree. It would expand to a number of code generation options, resulting in binaries only guaranteed to run on the local host CPU. Whether they were the most optimal options for your application on that CPU is a different story.

  • showing how useless you are, talking about compiler flags that are not available with zero context on what they actually do. Thank god some technical discussions still happen in the comments.

  • (make a new directory, download the kernel tarball into it)
    (unpack and cd into sources)

    cp /boot/config-`uname -r` ./.config
    scripts/config --disable DEBUG_INFO
    scripts/config --disable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT

    now do config. lately I am using make oldconfig because I am already using a recent kernel .config as my starting point and I am not asked too many questions. then...

    make clean
    nice ionice -c 3 make -j$(nproc) \
    CCACHE_DIR=$HOME/.local/cache/ccache \
    KCFLAGS=' -march=znver3' KCPPFL

Chemistry professors never die, they just fail to react.

Working...