Linus Torvalds, the creator of Linux, has been experimenting with AI-assisted kernel development, using Anthropic’s Claude Code to write patches that improve the Linux kernel’s memory management performance. The results are interesting, with some benchmarks showing more than three times higher read throughput.
The experiment, documented in an October 10 commit titled “mm: read from the page cache without folio references,” consists of eight patches targeting how Linux reads data from its page cache.
The problem Torvalds wanted to address involves how the kernel keeps track of memory pages. Under the existing implementation, reading cached data requires updating reference counters, which can create contention when several threads repeatedly access the same file.
To address this, the experimental patches use the kernel’s Read-Copy-Update mechanism to allow certain reads without acquiring additional page references. And the initial performance numbers are impressive.
On Torvalds’ laptop, with an Intel Core i7-8565U processor having four cores and eight threads, a benchmark with eight threads repeatedly reading 16 bytes from the same cached file improved from about 10 million reads per second to between 30 million and 33 million.
With four threads on separate CPU cores, throughput increased from roughly 9–12 million reads per second to 25–26 million. The single-threaded test showed a smaller improvement, rising from about 8 million to nearly 9 million reads per second.
There are important qualifications. All measurements were done on Torvalds’ laptop using ext4 with some kernel security mitigations disabled. The threefold improvement applies to a specific workload, not general Linux performance. The patches also add overhead in some cases, especially when reads encounter missing memory pages.
But what makes this experiment particularly noteworthy is how the code was developed. In the commit message, Torvalds explicitly acknowledges using Claude Code, Anthropic’s AI coding assistant, for much of the work:
“The code, the test programs, the review behind the list above and the first draft of this text were done with an LLM coding assistant (Claude Code) under my direction. The measurements were run on my machine.”
In other words, Claude Code helped generate the implementation, tests, review, and initial documentation, while Torvalds directed the work and ran the performance measurements himself.
That doesn’t mean AI-generated code is making its way into the Linux kernel without careful review. In fact, Torvalds spends much of the commit message discussing unresolved issues, including memory allocation behavior, compatibility concerns, potential regressions, and the performance impact of delaying memory reuse.
The experimental patches are based on Linux 7.3-rc6 with additional fixes and are available under the name noref-filemap-read-with-llm. For now, though, this remains an experiment rather than an optimization merged into the mainline kernel.
Whether any of these changes eventually make it into Linux remains to be seen.