Linux creator Linus Torvalds has turned to Anthropic's Claude Code to solve a kernel performance problem that developers have struggled with for more than two years, submitting on Tuesday a 10-patch series that he says delivers a 23-fold throughput improvement in a synthetic benchmark running on his Ryzen Threadripper system.
The patches target the page cache, the kernel mechanism that keeps recently used file data in memory. Torvalds spent 18 months running a broken version of his own fix for the page cache reference-counting bottleneck, while other developers had encountered problems with their own approaches. The bottleneck was flagged in 2024 by Matthew Wilcox, an Oracle engineer and longtime kernel memory-management developer, after it surfaced in a customer workload.
According to The New Stack, Torvalds said the assistant wrote the implementation, tests and initial documentation, and reviewed the code under his direction. He ran the benchmarks himself, despite having previously criticised developers who claim AI writes 99% of their code.
The patches eliminate folio reference-count operations from a common buffered-read path. Earlier attempts copied data without holding a folio reference and checked its validity afterwards, leaving races involving reclamation and replacement. The new series instead uses a new PG_rcu_free flag and RCU-delayed reclamation to protect the folio through the userspace copy, provided it does not fault.
Torvalds warned that the benchmark gains would be considerably smaller in real-world workloads. Kernel reviewers have since identified a race condition and raised concerns about memory reclamation, and Torvalds has handed further development to Kiryl Shutsemau, a kernel developer who previously worked on the same bottleneck.
On Torvalds' laptop, folio reference-count contention accounted for 99.92% of cross-core load HITMs in eight-thread tests, according to Hardware Busters. The original eight-patch branch of the work nearly tripled throughput on the laptop, and Phoronix first spotted the experimental branch, named noref-filemap-read-with-llm, in Torvalds' tree over the weekend.