Linus Torvalds uses Anthropic's Claude Code to write Linux kernel patches
Linus Torvalds said in a Git submission that a newly released set of Linux kernel patches was written largely by Anthropic's Claude Code under his direction. The eight-patch series, published on the noref-filemap-read-with-llm branch, aims to remove a performance bottleneck in the page cache when multiple threads make small reads from the same file.
The problem arises because repeated small reads from a cached file require updates to the reference count of the backing folio. Those updates involve atomic writes to a shared cache line, forcing processor cores to contend. Torvalds measured that 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 cross-core load. The issue has been known since 2024, and earlier fix attempts failed.
The proposed patches defer reuse of memory removed from the page cache until a read-copy-update (RCU) grace period has elapsed, allowing an RCU-protected reader to copy data directly into a user buffer without taking a folio reference. In Torvalds' test, eight-thread throughput rose from about 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 around 452-454 cycles to 408-409 cycles. He added that a machine with more CPUs or more than one socket should gain more, but nothing larger has been measured.
Torvalds also acknowledged trade-offs. He described the memory reclamation issue as "the part of this series that is least solved," and noted a regression when a read targets a user page that is not yet mapped, adding an extra failed exception before falling back. As of Oct 13, the branch remained outside mainline Linux 7.3-rc6, and whether it will be merged is uncertain. Torvalds said AI makes programming more enjoyable but stressed the need to be careful when using it for real and important work.


