Linux creator Linus Torvalds has officially acknowledged using artificial intelligence to generate code for the Linux kernel, marking a significant shift in his long-standing stance on the technology. In a recent Git submission, Torvalds revealed that the code, test programs, and initial review documentation for a new patch were largely drafted with Anthropic’s Claude Code under his supervision.
The patch targets a persistent performance issue within Linux’s page cache. When multiple threads simultaneously read small data sets from the same cached file, they compete for atomic writes to shared cache lines. This contention can severely degrade system performance. During testing on a four-core, eight-thread Intel Core i7-8565U laptop, Torvalds observed that this shared cache line accounted for 99.92% of cross-core load in specific workloads involving 16-byte pread() calls.
The proposed solution involves changing how the kernel handles memory reuse after it is removed from the page cache. Instead of returning memory to the allocator immediately, the patch defers reuse until a read-copy-update (RCU) grace period has elapsed. This allows readers to copy data directly into user buffers without repeatedly updating a shared reference counter. The results were substantial: eight-thread throughput increased from approximately 9.9–10.4 million reads per second to 30–33 million, while kernel cycles per read dropped from roughly 2,950 to 725. Torvalds noted that machines with more CPUs or sockets are expected to see even greater gains.
Despite these promising benchmarks, the fix is not yet ready for mainline inclusion. Torvalds described the memory reclamation aspect as “the part of this series that is least solved,” noting that delaying reuse can keep pages unavailable while the kernel waits for RCU periods. Additionally, the change introduces a regression when reads target unmapped user pages, causing an extra failed exception before falling back to existing implementations. As of October 13, the branch remained outside the Linux 7.3-rc6 release, and its future merger timeline is uncertain.
This development represents the culmination of a gradual evolution in Torvalds’ attitude toward AI. Initially skeptical and viewing the technology primarily as a bug-detection aid in late 2023, he began expressing enthusiasm for AI as a maintenance and coding tool by late 2025. After experimenting with AI-assisted coding in a personal Python project earlier this year, he told Dirk Hohndel at Open Source Summit Europe that he now “really likes using AI” and finds programming more enjoyable.
However, Torvalds cautioned that extreme care is required when applying AI to critical systems. He stated, “I think that you need to be very careful using AI when you’re doing something real and important,” adding that nothing is more critical than the Linux kernel. The current experiment demonstrates both the potential and the pitfalls of AI-assisted development, serving as a turning point for the open-source community.
I still think AI-generated kernel code is too risky. What happens when the model hallucinates on memory management?
That performance jump from 10M to 33M reads/sec is insane. The bottleneck was real.
Wait, so he wrote the patch or Claude did? Who actually reviewed it?
Mind blown. Linus using AI for actual kernel code is a massive cultural shift for open source.