Skip to content
Zenteck
Latest
Productivity

Linus Torvalds Uses Claude Code for Linux Kernel Patches

ByAlex Silva2 min read0 comments
linus-torvalds-uses-ai-for-linux-kernel
Photo: ZenteckLinus Torvalds uses AI for Linux kernel

Listen to article0:00 / 2:06

Linus Torvalds has officially crossed a major threshold by using an LLM coding assistant to write code for the Linux kernel. According to ZDNET, Torvalds used Anthropic's Claude Code under his direct supervision to produce an eight-patch series aimed at fixing a memory cache slowdown problem.

How the AI-Assisted Patch Works

The core issue involves contention in Linux's page cache when multiple threads make small reads from the same file. This creates competing updates to a shared cache line, slowing down multi-core processing.

To solve this, Claude Code helped draft an approach that defers memory reuse until an RCU grace period elapses. This allows readers to copy data directly into a user buffer without constantly updating shared reference counters.

The Real Performance Numbers

In benchmark tests on a four-core Intel laptop, the performance gains for specific small-read workloads were dramatic. Eight-thread throughput jumped from roughly 10 million reads per second to between 30 and 33 million reads per second.

Simultaneously, the kernel cycles required per read dropped from about 2,950 down to 725. However, this does not mean the entire operating system runs three times faster; the gains apply strictly to high-contention small-read scenarios.

Trade-offs and Veredito

Delaying memory reclamation introduces engineering risks, such as pages remaining unavailable longer than expected and minor regressions on unmapped user pages. Because of these unresolved trade-offs, the branch remains outside the mainline Linux release.

For developers evaluating AI tools, Torvalds' approach serves as a blueprint: treat the model as an assistant for complex, targeted problem-solving, but maintain rigorous oversight on critical production code.

Sources

  1. Linus Torvalds is using AI to develop Linux kernel code now — zdnet.com

Frequently asked questions

Did Linus Torvalds write Linux code with AI?
Yes. Torvalds used Anthropic's Claude Code to write an eight-patch series for the Linux kernel, handling code, test programs, and initial drafts under his direction.
What problem do the new patches solve?
They target a shared-memory cache bottleneck that occurs when multiple threads repeatedly read small amounts of data from the same cached file.
Is the AI-generated code already in the main Linux release?
Not yet. While test benchmarks showed a threefold increase in read throughput, unresolved memory-reclamation trade-offs have kept the branch out of the mainline kernel.