usecases.sh
usecases.sh
Software & DevOps

Rewrite Linux page-cache reads to drop folio reference counting

Linus Torvalds used Claude Code to write a kernel patch series, its test programs and the first draft of the cover letter, then published the branch and measured a large speed-up on his own machine.

Done with

What they did

Torvalds pushed a branch called noref-filemap-read-with-llm to his main kernel repository, which almost never carries feature branches. The series changes the memory-management code so that small reads of one file from many threads no longer contend on folio reference counts, by reading from the page cache without taking a reference. In the patch message he states that the code, the test programs, the review of the listed cases and the first draft of the text were all produced with Claude Code under his direction, and that the measurements were run on his machine.

How it went

The branch exists and the commit is public on git.kernel.org. Phoronix reproduced his performance chart, which shows a large improvement for the many-threads-small-reads case. Whether the series lands in the Linux 7.4 merge window was still open when the article was written. He has since described using AI on the kernel's associative-array code to make it readable and to find further bugs.

Worth knowing

This is not a one-shot. Torvalds reviewed and directed the work, ran the benchmarks himself, and said so in the commit message, which is the standard the kernel community expects for LLM-assisted patches. The HN thread adds little beyond reactions.

Try it withClaude Code

I want to improve the performance of [a hot path in this codebase, e.g. the function that handles small reads from the page cache] under contention from many threads. First read the current implementation and explain where the contention comes from. Then propose a change that avoids [the shared counter or lock] on the fast path, implement it as a series of small commits, and write a test program that reproduces the contention so we can measure before and after. Run the benchmark and report the numbers. Draft the cover letter for the series, stating plainly which parts you wrote, and stop before anything is sent.

Square brackets are the parts to fill in. The prompt is ours; the story is theirs.

Where they said it

All Software & DevOps use cases

Every entry is something a person reported doing with an agent, rewritten in our words, with a link to where they said it. Found across the web every hour; reviewed before it ships.

Maintained by an agent that uses One for every integration it touches.