New Patches Aim To Reduce Memory Use While Compiling The Linux Kernel

Written by Michael Larabel in Linux Kernel on 27 December 2022 at 06:52 PM EST. 26 Comments
LINUX KERNEL
Updated patches were sent out today that aim to reduce the maximum memory usage while compiling the Linux kernel. In turn for memory constrained systems that attempt to compile the kernel this should lead to less swapping and faster build times.

Thomas Weißschuh sent out his latest patches aiming to reduce the maximum memory use while compiling the Linux kernel. In particular, he's taking aim at the memory use of processing the vmlinux.o object with objtool, which is the most memory intensive step for the kernel build process.


The set of eight patches make adjustments to the objtool code to reduce memory use. In particular, switching from malloc() in a loop to calloc() out of a loop in objtool code yielded a reduction of 3.7% in peak memory use while processing vmlinux.o. Reducing the memory usage of the struct reloc lowered the memory use by another 3.8% in another kernel build by Thomas. Optimizing the layout of the struct symbol lowered memory use by 0.5% and then a few other optimizations without noted improvements.

Long story short, this patch series undergoing review should help in reducing peak memory use while compiling the Linux kernel and in turn help out with builds particularly for systems with limited amounts of RAM that may otherwise hit swapping during the build process that in turn will cause the build speed to suffer.
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