It's the first time in the history of the world.
I'll see you soon!
Even the father of Linux had Claude write the kernel.

Recently, when a developer was refreshing the official Linux kernel warehouse, Herren discovered an extremely unusual new branch.
noref-filemap-read-with-llm
Yes, the backdrop of this branch, "with-llm", clearly states: AI is involved in this project.

Who would have thought that Linus was the most vicious of those who used to crawl code, and this time he was the one who wrote the code with AI!
In Patch's latest explanation, he widely acknowledges:
From the core code, test cases, to revised reviews and document drafts, everything was hand-crafted with Claude Code.
The results of the run-out were indeed top-notch, with the throughput reaching about three times the original in a specific test of eight threads reading the same file.


The man who said, "90% of AI is marketing", smelled good.
Linus's father's new branchIt's called "llm".
Linus' father commanded Claude Code, the most central "memory management" mechanism in Linux.
The Linux kernel uses the page cache to cache file data.
A common operation in everyday multi-simultaneous business scenarios is: multiple threads go to small blocks simultaneously to read the same file.
According to existing mechanisms, each reading must modify the atomic reference count on the corresponding memory block (folio).
This leads to crazy execution between CPU cores.lock cmpxchgandlock declHowever, there is no evidence that this is the case.
As early as 2024, Matthew Wilcox, a core developer, pointed to this malady from a real customer production environment.
On Linus's own test machine, the bottle accounted for 99.92% of all "Load HITMs" expenses when eight threads were read together, almost filling the CPU's mainline bandwidth.
Claude got the job and went through a phase of "supplementing a few lines of code".

It is involved in implementing programs, writing programs for testing programs, and helping address potential problems.
These links are linked together to form a complete engineering experiment. The code that is written must run, the results must be measured, and the improvements measured must be explained.
The patch also explains its practical use. Other maintainers need to know why it needs to be changed, which paths are affected, and which cases the authors have checked.
After AI has written the initial draft, the description will still be compatible with the code and test data.
It is open to the public, and subsequent discussions are handy. Linus's quote "under my guidance" is here.

In the test, Linus used a laptop with Core i7-8565U, 4 core 8 threads, and an ext4 file system.
The test allowed multiple threads to read the same file over and over again, only reading 16 bytes at a time.
The patch explains the data given as follows:

8 threadsDensityThis is about three times as much as the original, and the single-line improvement is about 10 percent.
The key lies in "everyone reads the same document".
Linux caches the file data in the memory, which is the page caching. Subsequent reading can take the data directly from the caching, saving time to access the storage device again.
The memory in the cache is also recycled. The kernel must ensure that the memory is not released while the thread is still being read.
The original reading path adds and subtracts the reference count to memory objects that carry cached data. This object is called a portfolio and can be understood as a set of memory pages managed by the kernel.

The problem is that if you read several threads together, you have to repeatedly change the same count.
In order to keep the data consistent, the processor core had to move back and forth between the cache lines containing this count. Reading only 16 bytes at a time, the reading itself was fast, and the maintenance count costs were reversed into a bottleneck.
It's like eight people go through a book and every time they go through the first page, they struggle to change the same registry.
Linus patches tried to avoid this procedure on the reading path.
Its practice is to delay the removal of memory in the cache for a period of time before it is actually returned to the memory allocator, using the RCU mechanism to allow the relevant readings that have already been started to be completed.
In this way, the threads can directly copy data within the protected reading range, reducing competition for shared reference counts.
This also explains why the test benefits of having multiple threads sharing the same file are particularly apparent.
Following a BugAI digs up a decade old book.
If you thought Linus was just asking Claude to write new code, you underestimated the extent of this.
That's right.noref-filemap-read-with-llmOn the day after the branch came out, Linus's warehouse opened up another one.assoc-array-fixesThe book.
It is a set of data structures used to organize keystrokes and find objects. Its initial implementation dates back to 2013.
Just a few days ago, developer Nils Ollrogge submitted a bug report that also provided fixing patches.

Linus, after seeing it, encountered a problem: the code was too loose to logically follow.
With the help of a large model, he solved the code, dismantled some huge, hard-to-read functions, and made the boundaries of different operations clearer.
The test confirmed the problem in the Nils report and found three additional bugs.
All four bugs can be traced back to 2013 when the library was first submitted to the kernel.
Who would have thought that a Bug report would have uncovered three flaws that existed for over a decade?
One example is specific: when a root node structure is broken down, the bit segments used in the index are misplaced, causing the original entries to be no longer found.
The patch gives an example of a trigger that can be triggered with only 18 keys.

After the operation is completed, three of the objects cannot be seen; the same key is inserted again, and new objects are added, unable to correctly replace the original objects.
Another problem lies in the path of memory allocation failure.
In normal operation, it can be quietly silent. Once a distribution fails, clearing logic may follow the pointer into the old tree that is still in use, triggering a kernel error check.
Responsive testing causes each memory allocation rotation in the operation to fail, and each of the abnormal branches is examined to expose it.
These findings give "AI to help look at the code" a more specific meaning.
The old code is broken down and interpreted to make it easier to track; the test then pushes out the paths rarely followed.
The defect has thus been shown to be reproducible.
Even the dam is in the crater.It's important to recognize that programmers have a sense of superiority.
Linus Torvalds famously said, "Talk is cheap. Show me the code".
Everyone who knew him knew that this old man was extremely pragmatic and always looked at only two things: pricelessness and ineffectiveness.
This time, he showed another possible trick with action.
When code can be written by AI, it's really worth knowing what code to write and judging which code is wrong.
The man who once said "AI 90% is marketing" now hangs branches with "llm" on the back in his main warehouse.
Even my grandfather's grandmother is brushing KPI with AI, and who's still as vain as he is when he's dead trying to code?
