Linus Torvalds: AI Wrote Linux Kernel Patches and Test Programs
Key Takeaways Linus Torvalds utilized Claude Code, an AI coding tool, to assist in developing Linux kernel patches and test programs. The AI-assisted work focuses on enhancing page-cache read...
Key Takeaways
- Linus Torvalds utilized Claude Code, an AI coding tool, to assist in developing Linux kernel patches and test programs.
- The AI-assisted work focuses on enhancing page-cache read performance, specifically addressing bottlenecks in multi-threaded read operations.
- The project involved an eight-patch series designed to optimize how the kernel handles shared memory pages during frequent small reads.
- Early benchmarks on Torvalds’ personal machine showed significant improvements in read operations per second under specific conditions.
- This initiative highlights AI’s potential role in core operating system development, though the patches require extensive further testing and review before broader implementation.
AI Assists Linux Kernel Development: Linus Torvalds Reveals Claude Code’s Contribution
Linus Torvalds, the creator of Linux, has publicly disclosed that an artificial intelligence coding assistant, Claude Code, played a significant role in the creation of several Linux kernel patches and associated test programs. Under Torvalds’ direct supervision, the AI also contributed to reviewing technical materials and drafting initial technical documentation for the project.
Table Of Content
This collaborative effort targets improvements in page-cache read performance within the Linux kernel. The disclosure offers a transparent look into how advanced AI tools are being integrated into fundamental operating system development, while simultaneously acknowledging and documenting the current technical limitations of such systems.
Torvalds emphasized that all material generated by Claude Code was produced under his explicit guidance. He also noted that all performance measurements and testing were conducted on his personal system.
Addressing Performance Bottlenecks with AI
The project involved a series of eight patches aimed at resolving a critical bottleneck that arises when multiple threads simultaneously perform small read operations from the same cached file. Typically, each read operation necessitates an update to a “folio reference count.” A folio represents a collection of memory pages, and repeated updates to this count can lead to contention among processor cores vying for access to shared data.
The innovative solution proposed by this AI-assisted development delays the reuse of removed page-cache memory until an RCU (Read-Copy-Update) grace period concludes. This strategic delay ensures that active readers have ample time to complete their operations before the memory can be repurposed. This protective measure enables a new, faster read path capable of copying cached data without the overhead of acquiring and releasing folio references. In scenarios where the optimized path is not feasible, such as when cached data is missing or a user-buffer fault occurs, the existing read path seamlessly takes over.
Benchmark Results and Remaining Challenges
In the October 10 commit message, Torvalds reported impressive initial benchmark results. On his four-core, eight-thread Intel laptop, eight threads achieved approximately 30–33 million 16-byte reads per second from a cached file. This represents a substantial improvement compared to the baseline performance of 9.9–10.4 million reads per second.
It is crucial to note that these promising results are specific to a narrow benchmark and do not reflect overall Linux performance. The testing environment utilized ext4, with processor security mitigations and CONFIG_HARDENED_USERCOPY disabled. Furthermore, larger systems were not evaluated, and some read operations involving missing user-memory pages exhibited slower performance.
Memory pressure remains a significant concern. The strategy of delayed memory freeing can lead to substantial amounts of memory being held in limbo, awaiting reuse, without proper accounting by the allocator. While subsequent patches have mitigated this backlog, the technical write-up still acknowledges unresolved allocation issues and the lack of a firm upper bound for situations where grace periods extend slowly.
During testing, one specific check focused on detecting data corruption during repeated page eviction and reuse. Standard runs reported no instances of incorrect data. However, a deliberately introduced faulty version of the code did return incorrect bytes, including data from other users of freed memory, confirming the robustness of the detection mechanism.
The scope of testing was also acknowledged as limited, with no coverage for KASAN, lockdep, hardened usercopy, other architectures, or various stress test scenarios. This disclosure complements ongoing discussions regarding AI’s role in cybersecurity, including its application in security analysis and bug research within the Linux kernel. While AI can undoubtedly enhance development and investigation processes, these specific patches necessitate extensive broader testing and rigorous review before their performance gains and memory-safety claims can be validated under real-world workloads.
Disclaimer: HackersRadar reports on cybersecurity threats and incidents for informational and awareness purposes only. We do not engage in hacking activities, data exfiltration, or the hosting or distribution of stolen or leaked information. All content is based on publicly available sources.



No Comment! Be the first one.