Products & Tools

Linus Torvalds shipped Linux kernel patches written with Claude Code

Torvalds's Claude Code-assisted page-cache patches tripled eight-thread read throughput to 30–33 million reads/sec in his tests, with open questions before any mainline merge.

Linus Torvalds is using AI to develop Linux kernel code now
Linus Torvalds is using AI to develop Linux kernel code nowAI-generated
By Elena Vasquez5 min read

Updated

Why it matters

  • Torvalds released Linux kernel patches largely written with Anthropic's Claude Code, per his Git submission.
  • Eight-thread read throughput rose from ~10 million to 30–33 million reads/sec; kernel cycles per read fell from ~2,950 to 725.
  • The shared cache line accounted for 99.92% of cross-core load on a four-core Intel Core i7-8565U.
  • As of Oct. 13, the branch remained outside mainline Linux 7.3-rc6; Torvalds called memory reclamation 'the part of this series that is least solved.'
  • Torvalds discussed his AI use on Oct. 9 at Open Source Summit Europe in Prague with Dirk Hohndel.

Linus Torvalds has released a set of Linux kernel patches that were largely written with Anthropic's Claude Code — the first time the Linux creator has used an AI coding assistant to produce kernel code. He said so himself, in his own Git submission.

"The code, the test programs, the review behind the list above and the first draft of this text were done with an LLM coding assistant (Claude Code) under my direction," Torvalds wrote.

The patches tackle a shared-memory bottleneck inside Linux's page cache, the structure that holds file data in memory. It's a known problem, dating back to 2024, and earlier fix attempts went nowhere. Torvalds just moved the needle, with an LLM holding the pen.

Why does a cache line matter so much?

The problem sounds trivial. It isn't. When several threads repeatedly read small chunks of the same cached file, they take and release references to the folio backing that data. Each reference-count update requires an atomic write to a shared cache line, and processor cores end up fighting over it.

Torvalds measured the damage himself. On a four-core, eight-thread Intel Core i7-8565U laptop, with eight threads issuing 16-byte pread() calls against the same page, that single shared cache line accounted for 99.92% of measured cross-core load, according to Hit in Modified cache line (HITMs) statistics.

The fix changes when the kernel can reuse memory evicted from the page cache. Instead of returning that memory to the allocator immediately, the patches defer reuse until a read-copy-update (RCU) grace period has elapsed. A reader protected by an RCU read-side section can then copy data directly into a user buffer without ever taking a folio reference. The trade: slower memory reclamation in exchange for a read path that stops hammering a shared counter.

The numbers, within that specific test, are substantial:

  • Eight-thread throughput rose from roughly 9.9–10.4 million reads per second to 30–33 million.
  • Kernel cycles per read fell from about 2,950 to 725.
  • Single-thread reads improved more modestly, from about 452–454 cycles to 408–409 per read.

Torvalds noted the ceiling may be higher on bigger hardware. "A machine with more CPUs, or more than one socket, should gain more; nothing bigger has been measured," he wrote in his pull request.

One caveat worth pinning down: this does not mean Linux now runs three times faster. These are experimental results from one small-read workload on Torvalds's personal laptop — the machine he happened to have with him in Prague at Linux Plumbers.

Is the problem actually solved?

No. The performance gains arrive with real engineering costs. Deferring memory reuse means pages can sit unavailable while the kernel waits out an RCU grace period, and Torvalds didn't sugarcoat it — in his Git submission he called the reclamation issue "the part of this series that is least solved."

There's also a regression. When a read targets a user page that isn't yet mapped, the new path incurs an additional failed exception before falling back to the existing implementation. As of Oct. 13, the branch remained outside mainline Linux 7.3-rc6. Whether it gets merged, and on what timetable, is still undecided.

How did Torvalds get here?

The shift has been gradual, not a sudden conversion. In December 2023, Torvalds described AI as a potential aid with a narrow scope: "I see AI as a tool that can help us be better at what we do." At the time, his interest centered on using AI to find bugs — not to write code. Nobody, including him, was seriously proposing AI-authored kernel code.

By late 2025, he was calling himself "a huge believer in AI as a tool," and his interest had widened from bug-hunting to maintaining code and reviewing patches. In January 2026, he toyed with AI-assisted coding on a hobby project — a Python audio visualizer.

His remarks on Oct. 9, following a conversation with Dirk Hohndel at Open Source Summit Europe in Prague, went further. "I used to think it was just not very good — but now I'm at the point where I actually really like using AI," Torvalds said. "I think AI is a wonderful tool if you use it correctly and treat it as a tool, and I find it makes programming much more enjoyable."

He still kept one foot on the brake. "I think that you need to be very careful using AI when you're doing something real and important," he cautioned. Few software projects qualify as more real and important than Linux, the kernel that runs most of the internet's servers, every Android phone, and the majority of cloud infrastructure.

The page-cache experiment puts both halves of his position on display. Claude Code helped produce kernel code, tests, and review materials, and the branch shows genuine benchmark gains — but it also carries unresolved reclamation questions and a performance regression that must be answered before any of it becomes production kernel code.

Still, the milestone stands. Torvalds, arguably the world's most influential developer and maintainer, is now using AI to write new Linux kernel code. That would have been unthinkable a year ago, and it sets a precedent every other major open-source project — and every engineering organization watching from the sidelines — will now have to weigh for itself.

Original: events.linuxfoundation.org

Share this article:

More from Elena Vasquez

Elena Vasquez

Show full bio

Market editor covering technology and product news in artificial intelligence and machine learning at AI In Context.

252 articles

Related articles

  1. OpenAI cuts GPT-6 agent costs with smarter prompt caching
  2. OpenAI's WebSocket Overhaul Makes Agents 40% Faster
  3. Linus Torvalds: "I actually really like using AI" — with limits
  4. Saluki 27B: A 7.89 GB, 2-Bit Qwen3.8 That Beats the 54 GB Original at Tool Calling
  5. OpenAI's GPT-5.1-Codex-Max Flags Coming Cybersecurity Threshold

« Previous articleNext article »