Linux objtool Improvements Help Reduce RAM Usage & Build Time During Large Kernel Builds


Upstream kernel developers have begun hitting RAM capacity issues when carrying out large Linux kernel builds with the likes of «allyesconfig» for enabling all possible modules/options. While 32GB of system RAM has been common for developer desktops in recent years, large Linux kernel builds and taking advantage of multiple compile jobs have begun to cross that threshold and leading to out-of-memory behavior. Fortunately, a set of patches to the kernel’s objtool is taming the memory use to reign in kernel builds for such scenarios.

Prolific kernel developer Peter Zijlstra with Intel recently took to optimizing the memory use of objtool after «Boris [Petkov] complained he could no longer build allyesconfig on his 32G desktop machine without having [out of memory] terminate either objtool or chrome.»

Linux objtool RAM optimization

Zijlstra sent out a new patch series to reign in its memory use. These patches were able to shrink the memory use during a «allyesconfig» kernel build by about 6G, thereby allowing the large kernel build to succeed again comfortably on systems with ~32GB of RAM.

It also turned out the Linux kernel Clang continuous integration (CI) also began recently hitting memory issues while these patches have also addressed those problems. In addition these objtool patches sped up the kernel build time by nearly one minute for the all «yes» configuration.

Hopefully these objtool patches will be ready for the upcoming Linux v6.3 merge window.