Linus Torvalds has developed an experimental Linux kernel optimization with Claude Code, targeting a page cache bottleneck that slows concurrent reads.
The eight-patch series, documented in an October 10 commit on the noref-filemap-read-with-llm branch, nearly tripled throughput in one laptop benchmark.
Torvalds credited the assistant with implementation, test programs, review material, and initial documentation, all under his direction.
Linus Torvalds Uses Claude Code
The work addresses contention when multiple threads read small portions of the same cached file. Each read traditionally acquires and releases a folio reference, modifying shared reference-count metadata twice.
A folio represents one or more memory pages managed together. On Torvalds’ laptop, that contention accounted for 99.92% of load HITMs, reflecting cache coherence traffic between cores.
Instead of taking references, the proposed read path relies on read-copy-update, or RCU, to prevent premature memory reuse.
Folios removed from the page cache return to the allocator only after an RCU grace period, allowing protected readers to copy cached data directly into userspace.
The implementation introduces PG_rcu_free and defers final freeing rather than cache removal. During the RCU read section, page faults are disabled. Missing pages, incomplete data, user-buffer faults, and other conditions trigger fallback to the existing read path.
This approach aims to eliminate races that earlier reference-free designs attempted to detect after copying. Those designs could miss memory being freed, reused, and reinserted at the same cache index. Deferring reuse addresses that lifetime problem directly.
Testing used an Intel Core i7-8565U laptop with four cores, eight threads, and ext4. Eight threads repeatedly issuing 16-byte pread() operations against one cached page improved from approximately 9.9–10.4 million reads per second to 30–33 million.
Kernel stated that cycles per read dropped from 2,937–2,975 to 725–726. These results are workload-specific, not evidence of equivalent improvements across Linux applications.
Security mitigations and CONFIG_HARDENED_USERCOPY were disabled during benchmarking, while thermal throttling complicated throughput comparisons.
Reads into nonresident user buffers also became more expensive because the fast path first encounters a failed copy before fallback handles the fault.
Deferred freeing creates significant memory-management tradeoffs. Waiting pages remain invisible to allocator availability calculations, potentially causing premature out-of-memory decisions.
Additional patches speed up grace periods when per-CPU queues exceed 1,024 pages, reducing retained memory without fixing the accounting problem.
Torvalds also identified contiguous-memory allocation regressions, unresolved s390 secure-memory behavior, and untested configurations.
Race testing reported no corrupted reads, but deliberately bypassing deferred freeing produced incorrect data, demonstrating why the lifetime guarantee matters.
The series illustrates AI-assisted systems development, not autonomous kernel engineering. Its promising performance requires broader testing, independent review, and resolution of documented correctness risks before production adoption.
Join 16,000+ SOC teams using ANY.RUN to streamline threat investigations and reduce manual effort. Explore for your team
