Linus Torvalds recently tasked the artificial intelligence tool Claude Code with authoring modifications for a vital Linux kernel subsystem. Consequently, this experiment yielded a threefold acceleration when reading small data blocks during benchmark evaluations. Although the legendary developer openly credited the neural network for its authorship, he issued a clear caveat. Specifically, this experimental code remains unprepared for integration into the mainline kernel.
On October 10, the Linux creator published a series of modifications targeting the memory management subsystem. Engineers generated these eight distinct patches using Claude Code, an advanced programming utility developed by Anthropic. Furthermore, Torvalds explicitly noted that the AI authored the code, built test suites, analyzed known bugs, and drafted the initial documentation. Meanwhile, Torvalds personally supervised the overarching architecture and executed performance benchmarks on his local machine.
Eliminating the Page Cache Bottleneck
Fundamentally, these modifications alter the Linux page cache. This component retains recently accessed file data within volatile memory to prevent redundant storage drive queries. For years, kernel developers recognized a severe performance bottleneck when multiple threads simultaneously read minuscule fragments of a single file. Surprisingly, the underlying culprit was neither data retrieval nor byte copying; rather, it stemmed from the mechanism tracking memory page references.
During every read operation, the kernel increments the reference counter for the target memory page. Afterward, it decrements that counter once the operation concludes. This protocol prevents the premature reclamation of memory while an application actively processes the data. However, when disparate processor cores access the page concurrently, these atomic counter operations actively interfere with one another. Consequently, the cores must constantly synchronize modifications across the exact same memory region.
Measuring Cache Line Contention
Torvalds discovered a startling metric while reading 16-byte chunks from a single file across eight threads on an Intel Core i7-8565U laptop. Specifically, contention over the reference counter triggered 99.92% of all recorded modified cache line transfers between processor cores. Notably, this figure reflects Load HITM events rather than a percentage of total program execution time. Nevertheless, the telemetry vividly demonstrated the exorbitant computational cost of core synchronization under such workloads.
To resolve this, the patches generated by Claude Code enable data reads without continuously mutating the reference counter. Instead of the legacy scheme, the system employs the Read-Copy-Update (RCU) mechanism. This approach delays the reallocation of freed memory until critical read phases conclude. Even if the system evicts a page from the file cache, the kernel withholds that memory from new data until the RCU-protected reader finishes its task.
Impressive Benchmarks and Hardware Telemetry
Ultimately, the benchmark results proved extraordinary. Under concurrent eight-thread workloads, throughput surged from roughly 10 million to over 30 million read operations per second. Similarly, four threads running on dedicated physical cores jumped from roughly 10 million to 26 million operations. Conversely, single-thread performance improved more modestly, rising from 8 million to 8.9 million reads per second. Meanwhile, the processor cycles required per operation across eight threads plummeted from approximately 2,950 down to 725.
Additional telemetry confirmed that the modification successfully eradicates inter-core contention. Specifically, Load HITM events during the eight-thread benchmark plunged from 30,538 to a mere 101. Torvalds suspects that multi-socket enterprise servers will exhibit even more dramatic gains, though he has not yet tested this hypothesis. He gathered all published metrics on a single quad-core, eight-thread laptop utilizing the ext4 file system with several kernel security mitigations disabled.
Memory Overhead and Edge-Case Regressions
Despite these gains, the acceleration introduces notable trade-offs. Delayed page reclamation can significantly inflate RAM consumption, particularly when applications rapidly generate and delete data. During an early test on a system with 2 GB of RAM, the patches prematurely triggered the Out-Of-Memory (OOM) Killer, which forcibly terminates active processes. Although subsequent adjustments bypassed that specific test failure, they did not fully resolve the underlying accounting issue for pages awaiting reclamation.
Furthermore, Torvalds documented a performance regression within a specific read scenario. If a required user buffer page is absent from RAM, the new algorithm first attempts an unsuccessful copy operation before reverting to the legacy mechanism. Under this condition, computational overhead increased from roughly 4,100 to 6,500 processor cycles. While the broader throughput gains likely outweigh this penalty during normal workloads, the net benefit depends heavily on usage patterns.
Unresolved Architectural Questions
Internal audits also revealed several other unresolved complications. For instance, delayed reclamation disrupts certain contiguous memory allocation operations and alters the behavior of specific data transfer mechanisms. Additionally, the code requires further evaluation on the s390 architecture, and the CPU cost of mass page reclamation during prolonged workloads remains unknown. Consequently, Torvalds cataloged these caveats within the commit notes and invited fellow developers to scrutinize the controversial design choices.
The Road Ahead for AI-Assisted Kernel Development
Despite promising local benchmarks, the patch series has not yet undergone comprehensive validation. Specifically, Torvalds has not executed the standard xfstests file system suite, deployed KASAN to detect memory access errors, or verified 32-bit compilations. Moreover, the code lacks testing across diverse hardware configurations and specialized kernel builds. Given the extreme sensitivity of the memory management subsystem, these omissions currently preclude the algorithm from widespread production deployment.
Historically, efforts to accelerate small read operations began long before this current patch series. Back in 2024, kernel developer Matthew Wilcox highlighted this exact bottleneck within real-world user workloads. However, subsequent attempts to eliminate redundant reference counter operations repeatedly encountered perilous memory reuse scenarios. The new AI-assisted approach tackles the dilemma differently by preventing premature page reallocation rather than validating already copied data.
Currently, the experimental series resides in a dedicated branch named noref-filemap-read-with-llm, built upon Linux 7.3-rc6 alongside supplementary fixes. The modifications remain excluded from the mainline kernel branch, and a timeline for potential adoption is entirely unknown. In fact, Torvalds admitted uncertainty regarding several architectural decisions, noting he would prefer to avoid modifying the scheduler just to accelerate memory reclamation.
Ultimately, this experiment fascinates the Linux community not merely for its benchmark metrics, but for its developmental methodology. The creator of Linux entrusted Claude Code with low-level memory management mechanics, a domain where minor flaws can trigger data corruption, system panics, or severe security vulnerabilities. By transparently disclosing the AI’s involvement and detailing the code’s limitations, Torvalds demonstrated that while the patches prove a specific scenario can be vastly accelerated, they do not yet represent a blanket threefold speedup for Linux as a whole.
Support Our Threat Intelligence
Find our tech and OS security coverage helpful? Support our work today and unlock a 100% ad-free reading experience!