New Patches Aim To Reduce Memory Use While Compiling The Linux Kernel
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.