AI Claude wrote code for Linux kernel optimization
Linux creator Linus Torvalds has prepared a set of patches for the kernel's memory management subsystem. In the commit description, he explicitly stated that all code, tests, and draft documentation were created using the Claude artificial intelligence.
The developed algorithms aim to accelerate reading small data blocks from the page cache. The experiment revealed a bottleneck: when read simultaneously by 8 threads of 16 bytes each, 99.92% of the time is spent waiting for access to the reference counter, not on the actual read operation.
To solve this problem, instead of locks and atomic changes to the counter, the RCU (Read-Copy-Update) mechanism for deferred memory freeing is used. A page will not be freed until the thread finishes copying the necessary data.
Testing results demonstrate significant performance growth:
- 8 threads: speed increased from ~10 to 30–33 million operations per second (three times faster)
- 4 threads: increase from 8.9–11.6 to 25–26 million operations per second (approximately twice as much)
- 1 thread: improvement from 7.9–8.1 to 8.8–8.9 million operations per second
The changes are in a separate branch named noref-filemap-read-with-llm. The question of whether these patches should be included in the main Linux kernel or remain experimental status remains open.









