Skip to content
Apixo
Blog
news· 3 min read· via ZDNet AI

Linus Torvalds Embraces AI to Tackle Linux Kernel Performance

Linus Torvalds has released Linux kernel patches largely written with Anthropic's Claude Code, marking a major turning point in his approach to AI-assisted software development.

Linus Torvalds Embraces AI to Tackle Linux Kernel Performance

Linus Torvalds has released a set of patches for the Linux kernel that were largely written with Anthropic’s Claude Code. These new code submissions are designed to address a persistent memory cache slowdown issue that occurs when systems utilize multiple processors and cores. Over the past few years, Torvalds' perspective on artificial intelligence has shifted gradually from skepticism to seeing it as a helpful assistant for software developers and maintainers.

In his Git submission, Torvalds explicitly noted that the code, test programs, review materials, and the first draft of the accompanying text were generated using an LLM coding assistant under his direction. This step follows a documented evolution in his viewpoint. Back in December 2023, he viewed AI primarily as a potential bug-hunting aid rather than a tool for writing core code. By late 2025, he expressed enthusiasm for AI in code maintenance and review, and by January 2026, he began experimenting with AI-assisted coding for a personal Python audio visualizer project. Following a conversation at the Open Source Summit Europe in Prague, Torvalds stated that he now really likes using AI when treated properly as a tool.

Tackling a Shared-Memory Bottleneck

The experimental patches aim to solve a known bottleneck involving contention in the Linux page cache, which stores file data in memory. When multiple threads repeatedly read small amounts of data from a shared cached file, they acquire and release references to the folio backing that data. These updates require atomic writes to a shared cache line, forcing processor cores to compete and creating a significant drag on performance.

During testing on a four-core, eight-thread Intel Core i7-8565U laptop with eight threads issuing 16-byte pread() calls against a single page, the shared cache line accounted for nearly all measured cross-core load. Previous attempts to fix this issue since 2024 had failed.

The solution developed with Claude Code changes when the kernel can reuse memory removed from the page cache. Instead of returning memory immediately to the allocator, the patches delay reuse until an RCU grace period passes, allowing readers to copy data directly into user buffers without taking a folio reference. In benchmark tests, eight-thread throughput rose from roughly 9.9 to 10.4 million reads per second to between 30 and 33 million, while kernel cycles per read dropped significantly. Single-thread performance showed more modest improvements.

Unfinished Work and Trade-offs

Despite the promising benchmark numbers, the code is not yet a complete fix and remains outside the mainline Linux 7.3-rc6 branch. The approach introduces engineering trade-offs, specifically delaying memory reclamation so that pages remain unavailable while waiting for an RCU grace period. Torvalds described this memory reclamation issue as the least solved part of the series. Additionally, a regression occurs when reads target unmapped user pages, causing an extra failed exception before falling back to the standard implementation.

What it means for developers

Torvalds' adoption of Claude Code for kernel-level development demonstrates that LLM assistants can successfully reason about complex systems engineering problems, such as memory cache contention and low-level threading bottlenecks. However, the experiment also highlights that AI-generated code often requires rigorous human direction, curation, and handling of tricky trade-offs like delayed memory reclamation and edge-case regressions. For developers looking to experiment with similar workflows, solutions like Apixo allow users to test top AI models cheaply through one API at https://apixoai.online. As Torvalds noted, while AI makes programming more enjoyable and serves as a wonderful utility, developers must still exercise caution when applying it to critical software.


Source: Linus Torvalds is using AI to develop Linux kernel code now — ZDNet AI. Written by the Apixo team from that report.

#ai-news#linux#linus-torvalds#claude-code#artificial-intelligence#kernel
Try it with your own tools

One key for Claude, GPT, GLM, DeepSeek and more. Pay per token with crypto.

Get your API key

Keep reading