AI Fixes Linux Bottlenecks Using “Hideous” Code
A Linux developer used AI to fix bottlenecks that caused problems when building the kernel. The resulting AI-generated code needed a lot of work.
Most people assume AI makes life easier. Sometimes, that's the case – other times, not so much. Such was the case when Linux developer Lorenzo Stoakes of Arm decided to fix a few single-thread bottlenecks that caused a typical kernel build to "consist of a frustratingly large amount of time," Stoakes reported in a kernel.org email. By fixing those bottlenecks, Stoakes found that "allmodconfig builds up to 36% faster, incremental builds up to ~70% faster, and noop builds up to ~90% faster."
In that same email, Stoakes stated that he used an LLM to determine where the bottlenecks were and how to improve them. He then said that the LLM generated a lot of code, "much of it hideous."
"The patches work to parallelize a lot of single-threaded tasks and improving the efficiency of the build process," a Phoronix report stated. "Areas such as Kbuild, kallsyms, modpost, objtool, mksysmap, and the Rust build system were all affected by this work."
Stoakes had to audit and rewrite much of it and heavily edit commit messages, the cover letter, and comments.
Although the AI code required a lot of extra work, it did manage to fix the bottlenecks. After manual verification, the performance improvements were found to be legitimate.
Do note that since an LLM was used extensively to solve the bottleneck problem, each associated commit carries an Assisted-by tag.