Torvalds Uses Anthropic's Claude Code to Write Linux Kernel Patches
Torvalds used Anthropic's Claude Code to write Linux kernel patches fixing page-cache contention, a shift in his stance.
In his Git submission, Torvalds wrote, "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." ZDNet reported that the patches were largely written with Claude Code and address an unsolved memory cache slowdown when multiple cores and processors are used.
The fix targets contention in Linux's page cache, which holds file data in memory. When several threads repeatedly read small amounts of data from the same cached file, they take and release references to the folio backing that data. Those reference-count updates require atomic writes to a shared cache line, forcing processor cores to compete over it. In a test on a four-core, eight-thread Intel Core i7-8565U laptop, Torvalds found that when eight threads issued 16-byte pread() calls against the same page, the shared cache line accounted for 99.92% of measured cross-core load, according to Hit in Modified cache line (HITMs).
The problem has been known since 2024, and earlier attempts to fix it came to naught. Torvalds and Claude Code's proposed patches change when the kernel can reuse memory 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. That lets a reader protected by an RCU read-side section copy data directly into a user buffer without taking a folio reference. The approach trades immediate memory reclamation for a read path that avoids repeatedly updating a shared reference counter.
The reported performance gains were substantial within that specific test. Eight-thread throughput rose from approximately 9.9–10.4 million reads per second to 30–33 million, while kernel cycles per read fell from roughly 2,950 to 725. Single-thread reads improved from about 452–454 cycles to 408–409 cycles per read. Torvalds added in his pull request that "A machine with more CPUs, or more than one socket, should gain more; nothing bigger has been measured." ZDNet reported that this does not mean Linux as a whole runs three times faster; the results came from a particular small-read workload on Torvalds's personal laptop, which he had with him in Prague at Linux Plumbers.
The patches do not fully resolve the issue. Delaying memory reuse means pages can remain unavailable while the kernel waits for an RCU grace period. In his Git submission, Torvalds described that reclamation issue 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. As of Oct. 13, the branch remained outside the mainline Linux 7.3-rc6, and whether it will be merged, and on what timetable, remains uncertain.
Torvalds's decision reflects a long-term evolution in his attitude toward AI. In December 2023, he 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 the time, his interest was around identifying bugs rather than writing code. By late 2025, he was calling himself "a huge believer in AI as a tool" and saying he was more interested in maintaining code and reviewing patches. In January 2026, he began toying with AI-assisted coding for a Python audio visualizer in a hobby project. In remarks reported Oct. 9 following a conversation with Dirk Hohndel at Open Source Summit Europe in Prague, Torvalds said, "I used to think it was just not very good — but now I’m at the point where I actually really like using AI."