Linus Torvalds has done something that would have struck most kernel developers as unthinkable a few years ago: he has submitted Linux kernel patches that were largely written by an AI coding assistant. In the submission accompanying a new patch series, the Linux creator wrote that “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 disclosure came as part of a patch set aimed at a long-standing performance problem in the kernel's page cache — one that has resisted fixes since at least 2024. In the context of a codebase with tens of millions of lines, the work itself is small and technical. What makes it notable is its provenance.
For the original author of Linux and still its most authoritative maintainer to hand a meaningful portion of kernel development to a large language model signals a shift in how even the most conservative corners of systems programming may operate going forward.
A page-cache bottleneck hiding in plain sight
To understand why the patch matters technically, it helps to understand what the kernel's page cache does. The page cache holds copies of file data in memory so that reads do not have to go back to disk. When a program reads from a file, the kernel typically serves that data from the cache rather than from storage, which is the single biggest reason Linux feels fast for I/O-heavy work.
Modern kernels manage cached file data through an abstraction called the folio, a unit of memory that replaced the older per-page accounting model for compound pages. Every time a thread reads from a cached folio, it must take and then release a reference to that folio. Those reference counts are updated atomically, because multiple threads may be touching the same object concurrently.
Atomic reference-count updates sound cheap, and individually they are. The problem is contention. When several threads repeatedly read small amounts of data from the same cached file, they all hammer the same reference counter, which lives on a single cache line. Every atomic update forces the owning cache line to bounce between processor cores, and the result is severe cross-core traffic for no useful work.
Torvalds measured exactly how bad this can get. With eight threads issuing 16-byte pread() calls against the same page on a four-core, eight-thread Intel Core i7-8565U laptop, the shared cache line accounted for 99.92% of the measured cross-core load, as tracked by Hit in Modified cache line events — a hardware counter that records when one core must fetch a line another core has dirtied. In other words, effectively all of the costly cross-core activity in that workload was caused by threads fighting over a single reference count.
This was not a personal itch. The issue has been known since 2024, and earlier attempts to address it did not land.
What the patches actually change
The approach Torvalds and Claude Code settled on alters when the kernel is allowed to reuse memory that has been removed from the page cache. Instead of returning that memory to the allocator immediately, the patches defer reuse until a read-copy-update (RCU) grace period has elapsed.
RCU is one of the kernel's core synchronization mechanisms: readers proceed without locking, and writers wait until every pre-existing reader has finished before freeing or reusing the old data. By tying page reuse to an RCU grace period, the new read path can copy data directly into a user buffer without ever taking a folio reference. No reference means no atomic increment, and no atomic increment means no cache line ping-ponging between cores.
The trade-off is explicit: the kernel gives up immediate memory reclamation in exchange for a read path that never touches a shared counter.
The benchmark numbers, and what they do not mean
Within the specific test workload, the reported gains are substantial. Eight-thread throughput rose from roughly 9.9–10.4 million reads per second to between 30 and 33 million. Kernel cycles consumed per read fell from about 2,950 to roughly 725. Single-thread reads improved far more modestly, from around 452–454 cycles per read to 408–409.
Torvalds noted in the pull request that “a machine with more CPUs, or more than one socket, should gain more; nothing bigger has been measured.”
It is important not to over-read these figures. Linux as a whole does not run three times faster, and no one is claiming otherwise. The numbers describe a narrow experiment: many threads performing tiny reads against the same cached page, measured on a personal laptop that happened to be on hand. Different workloads — large sequential reads, write-heavy I/O, memory-constrained systems — will behave differently.
What remains unsolved
The patch series is not a fix, and Torvalds does not present it as one. The performance gains come with real engineering costs. Delaying memory reuse means pages can remain unavailable while the kernel waits for an RCU grace period to elapse, which is a genuine concern on systems under memory pressure. In the submission, Torvalds described the reclamation problem as “the part of this series that is least solved.”
There is also a regression: when a read targets a user page that is not yet mapped, the new path incurs an additional failed exception before falling back to the existing implementation. That is a cost paid by workloads that the optimization does not help.
As of mid-October, the branch remained outside the mainline kernel tree. Whether it will ever be merged, and on what timetable, depends on the usual gauntlet of review, testing and rework that every kernel change faces — a process in which the origin of the code carries no particular weight, only its correctness and its long-term maintainability.
From AI skepticism to hands-on use
The decision to use Claude Code reflects a gradual evolution rather than a sudden reversal. In December 2023, Torvalds described AI as a potential aid to developers, saying, “I see AI as a tool that can help us be better at what we do.” At that point his interest centered on bug identification rather than code generation. Serious AI-authored programs were not part of the conversation.
By late 2025, he was calling himself “a huge believer in AI as a tool,” and his focus had broadened beyond finding bugs to maintaining code and reviewing patches. Generating new, serious kernel code was still largely off the table. Then, in January 2026, he began experimenting with AI-assisted coding on a hobby project: a Python audio visualizer.
His remarks on October 9, made during a conversation at Open Source Summit Europe in Prague, were more enthusiastic still. “I used to think it was just not very good — but now I'm at the point where I actually really like using AI,” Torvalds said. “I think AI is a wonderful tool if you use it correctly and treat it as a tool, and I find it makes programming much more enjoyable.”
He paired that endorsement with a caution that applies directly to his day job: “I think that you need to be very careful using AI when you're doing something real and important.” Few software projects are more real or more important than the kernel that underpins most of the world's servers, phones, embedded devices and cloud infrastructure.
Why one patch series carries outsized weight
The Linux kernel is one of the largest and most heavily reviewed software projects in existence, developed by thousands of contributors and released on a roughly nine-to-ten-week cadence. Its maintainers are chronically overworked, and the volume of patches arriving on mailing lists and in Git trees has grown faster than the review capacity available to process them. Against that backdrop, any credible tool that reduces the cost of writing, testing and reviewing code is difficult to dismiss.
Still, the kernel community has legitimate questions about AI-assisted contributions that go beyond code quality. Provenance and licensing matter: contributors must be able to certify the origin of what they submit, and AI-generated code raises unresolved questions about where training data ends and novel expression begins. Attribution matters too, since the project's sign-off process assumes a human author who understands and stands behind the change. And review standards do not relax just because a machine drafted the first version — a maintainer still has to understand every line well enough to defend it.
The page-cache experiment puts both sides of Torvalds' position on display. An AI assistant helped produce kernel code, test programs and review materials, and the resulting branch shows promising benchmark gains. It also carries unresolved memory-reclamation questions and a known regression that must be dealt with before the work could ever become production kernel code.
Torvalds' own framing — treat AI as a tool, use it carefully when the stakes are high — is now being tested on the highest-stakes codebase he controls. The branch sits outside mainline, awaiting review like any other submission, with no announced date for a decision.
Source: ZDNET News