Linus Torvalds accepted a 10‑patch series produced with Anthropic’s Claude Code that eliminates folio reference‑count handling in the common buffered‑read path of the Linux page cache. The change delivers a synthetic benchmark gain of roughly 23× on a 64‑core Threadripper and a three‑fold gain on a laptop, while also introducing a new PG_rcu_free flag and RCU‑delayed reclamation to protect folios during user‑space copies.
What Changed
The patches replace the traditional reference‑count increment/decrement sequence with a lock‑free path that relies on RCU to defer reclamation. The implementation, tests, and initial documentation were generated by Claude Code under Linus’s direction. A subsequent revision, referred to as the “rcu‑free‑v3” series, adds the PG_rcu_free flag and uses RCU‑delayed reclamation to keep a folio valid through the copy operation, provided the copy does not fault.
Why It Matters to Practitioners
Page‑cache contention has been shown to dominate cross‑core load HITMs, accounting for 99.92% of such events on an eight‑thread Core i7 test platform. Reducing the reference‑count overhead can therefore lower kernel cycles per read dramatically—from roughly 2,950 to 725 on a laptop and from about 20,000 to 735 on a 64‑thread system. For workloads that are heavily read‑bound and suffer from cache‑line bouncing, the performance delta can be significant.
Architectural and Operational Implications
Adopting the new path changes the memory‑reclamation contract in two ways:
- RCU‑delayed reclamation: The kernel now defers freeing a folio until after an RCU grace period, which can trigger expedited grace periods when a CPU queues more than 1,024 pages. This may affect latency‑sensitive paths that rely on prompt reclamation.
- New
PG_rcu_freeflag: The flag must be set while a folio can still be mapped into userspace. Reviewers have raised concerns that the flag’s semantics differ from traditional page‑type based reclamation, and that it may not cover truncate or hole‑punch scenarios.
Early testing also showed a regression for reads into unmapped user pages: a single‑thread read cost rose from about 4,150 cycles to 6,550 cycles due to an extra fault before falling back to the existing path. It is unclear whether the revised series eliminates this regression.
Maintainers have debated the design. Matthew Wilcox suggested using a page type and reclaiming inactive‑list folios after an RCU grace period, but Linus argued that the flag must be set earlier to protect mapped folios. Kiryl Shutsemau proposed limiting the flag to 64‑bit systems, a suggestion supported by David Hildenbrand.
Related CloudNinjas coverage: AI engineering.
What This Means For Practitioners
Teams that rely on high‑throughput read workloads should evaluate the new patches in a controlled environment before enabling them in production. Key actions include:
- Benchmark real‑world workloads to verify that synthetic gains translate to operational improvements.
- Monitor RCU grace‑period latency and page‑queue lengths to detect potential stalls caused by the expedited grace‑period rule.
- Validate that the
PG_rcu_freeflag does not interfere with file‑size extensions, truncates, or hole‑punch operations, especially on 32‑bit platforms where the flag may be inappropriate. - Stay tuned to upstream discussions, as further revisions may address the identified race in
filemap_read_rcu_batch()and refine the reclamation strategy.
In short, the AI‑generated patches offer a compelling performance opportunity, but the accompanying reclamation changes introduce new complexity that must be carefully vetted.


