AI wrote “ugly” code, but found the bottlenecks and sped up the Linux kernel build

Translated by a model; the original is in Russian.

· Linux and open source
ARM engineer Lorenzo Stoakes used a language model to uncover single-threaded bottlenecks in the Linux kernel build — and achieved speedups of up to 70% on incremental builds.

cover.svg

ARM engineer and longtime Linux kernel developer Lorenzo Stoakes has submitted a series of 23 patches meant to “substantially speed up kernel builds.” At the heart of the work is the fight against single-threaded bottlenecks that leave the compilation process idling for long stretches, without putting all of the CPU's cores to use.

A noticeable gain

The results, according to the author, are impressive. A full kernel build with all modules enabled became roughly 36% faster, incremental builds up to 70%, and “noop” builds — where there is essentially nothing to rebuild — nearly 90% faster. The gains have been confirmed on a range of hardware and across different kernel configurations.

The patches parallelize a number of previously single-threaded tasks and improve build efficiency overall. The changes touch Kbuild, kallsyms, modpost, objtool, mksysmap and the build system for Rust.

The role of the language model

The most curious part is how the work was actually done. Stoakes was candid in admitting that an unnamed large language model was used both to hunt for bottlenecks and to prepare the fixes. In his own words, the model “generated a lot of code, a significant portion of which was ugly.”

The developer stresses that he did not blindly trust the machine: he carefully reviewed and in large part rewrote the generated code, and heavily edited the commit messages, the cover letter and the comments. Meanwhile, the LLM took on the drudgery — running builds, testing, debugging and analysis. The correctness of the patches on built and booted kernels, as well as the performance gains, Stoakes verified by hand.

Because the model was involved so closely in the work, every commit carries an Assisted-by tag — a kind of honest acknowledgment of the machine's co-authorship.

If the series is approved by reviewers, it has a chance of landing in the mainline Linux kernel and noticeably cutting build times for all developers. The episode itself neatly illustrates the balance that is taking shape: AI does a decent job of finding problems and handling the grunt work, but the final quality is still ensured by a human willing to rewrite “ugly” code from scratch.


Source: Phoronix

Comments

Sign in, to comment.

  • No comments yet.