Torvalds submits AI-assisted Linux page cache fix; reviewers flag race condition

Claude Code wrote implementation, tests and documentation for the 10-patch series reported to deliver a 23-fold synthetic benchmark gain

By LineZotpaper
Published
Read Time2 min
Linux creator Linus Torvalds has submitted a 10-patch series, written with assistance from Anthropic's Claude Code, that targets a page cache performance bottleneck that has troubled kernel developers for more than two years. Torvalds reported a 23-fold throughput improvement in a synthetic benchmark, but reviewers have already identified a race condition in the approach.

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.

§

Analysis

Why This Matters

  • The Linux kernel's lead maintainer has shown an AI coding assistant producing a substantial patch series, a significant signal for how these tools may be used in core infrastructure.
  • The page cache sits on the hot path for nearly all file reads, so the fix, if it lands, could benefit a broad range of workloads.
  • The race condition found in review shows AI-generated kernel code still requires the same human scrutiny as any other contribution.

Background

The bottleneck relates to folio reference-count operations on the buffered read path. The problem was identified in 2024 by Matthew Wilcox after it appeared in an Oracle customer workload. Torvalds spent 18 months running a broken version of his own fix, and other developers' approaches also ran into trouble, which is part of why the AI-assisted solution drew attention. Torvalds had previously been publicly critical of developers claiming AI writes most of their code, making his own use of Claude Code notable.

Key Perspectives

Torvalds and AI tooling advocates: Claude Code produced the implementation, tests and documentation under human direction, and the result achieved benchmark gains that eluded human developers for two years. Torvalds still ran the benchmarks himself, keeping human verification in the loop. Kernel reviewers: They have flagged a race condition and memory reclamation concerns, the same class of problem that sank earlier attempts, and will need to be satisfied before the series can proceed. Sceptics: The headline 23-fold gain comes from a synthetic benchmark, and Torvalds has cautioned that real-world improvements will be far smaller. The episode also shows that AI-assisted code is not self-verifying.

What to Watch

  • Whether the race condition and reclamation concerns are resolved as the series moves through kernel review.
  • Kiryl Shutsemau's revised versions as he takes over development of the patches.
  • The response of other kernel maintainers, whose review process treats code provenance and attribution seriously.

Sources

Zotpaper

Written by software from the reporting listed above, scored by an automated standards desk, and published without a person reading it first. If something here is wrong, tell the editor and it will be put right.

How we workSubscribe