Kbuild series targets serial bottlenecks for far faster kernel builds
Lorenzo Stoakes’s v3 patches claim up to 36% faster full allmodconfig builds, roughly 70% faster incrementals, and about 90% faster no-op rebuilds.
A third-round kbuild overhaul from Lorenzo Stoakes (ARM) aims to cut the single-threaded stalls that dominate many Linux kernel builds, with measured gains of up to 36% on full allmodconfig runs, around 60-70% on incremental rebuilds, and roughly 90% on no-op makes across large x86 machines and an M2 MacBook.
Stoakes’s cover note frames a typical build as time lost in serial tails: repeated toolchain probes, modpost and objtool work on the critical path, thousands of tiny module-finalization jobs, a blocking Rust prepare step, and single-threaded image compression. The series attacks those points rather than the parallel compile bulk.
Toolchain feature probes that once ran on every make invocation move into Kconfig once-per-compiler checks. Modpost caches section-mismatch lookups that previously rescanned the same tables for every relocation. Module descriptors that were emitted as C (and thus compiled, dependency-scanned, and objtool’d like ordinary objects, eleven thousand of them on an x86-64 allmodconfig) become assembly instead, with finalization batched in chunks so make is not drowning in millisecond jobs and cmd-file churn.
Objtool’s work on linked images gets denser relocation and instruction hashing, drops needless DWARF hash traffic, and can decode instructions in parallel (capped) when processing large linked objects. Rust crates no longer stall the start of every clean CONFIG_RUST build behind prepare; they build alongside C with explicit dependencies. Kernel image compression can use pigz when present, coordinated with make’s jobserver, while modules and packaging keep ordinary gzip.
Stoakes reports the wins across Threadripper, dual-socket EPYC, and Apple M2 hardware with both gcc and clang, and states object output stayed byte-identical where checked. Kees Cook reviewed several pieces positively, including the pigz integration and module batching. Linus Torvalds flagged the M2 gcc full-build delta as oddly small relative to the other numbers, leaving that anomaly open.
If merged, the practical effect is shorter wall times for developers and CI on large configs, especially rebuild and no-op cycles, without changing the built kernel’s behavior.