Mazda CX5
Хочете будувати кар’єру в Data Science та AI? Vodafone Big Data Lab відкриває новий набір —>

Linus Torvalds used Claude Code to optimize the Linux kernel: cache read speed tripled

Linux creator Linus Torvalds has released an experimental series of eight patches, developed with the help of AI assistant Claude Code, aimed at addressing a long-standing bottleneck in the kernel's file caching that significantly slows down parallel data reads.

Leave a comment
Linus Torvalds used Claude Code to optimize the Linux kernel: cache read speed tripled

Linux creator Linus Torvalds has released an experimental series of eight patches, developed with the help of AI assistant Claude Code, aimed at addressing a long-standing bottleneck in the kernel's file caching that significantly slows down parallel data reads.

The patches are placed in the noref-filemap-read-with-llm branch of Torvalds' personal repository. According to the developer, the artificial intelligence performed code writing, test program creation, initial review, and documentation drafts under his direct supervision, Cyber ​​Press reports .

What is the problem and what solution was found?

Currently, when multiple threads read small chunks of the same cached file in parallel, there is high contention for metadata. Traditionally, each read call acquires and releases a reference to a folio (a bundle of memory pages), changing the shared reference count twice. On Torvalds' laptop, this caused as much as 99.92% of cache coherence traffic between processor cores.

Instead of constantly changing the reference count, the proposed approach uses the RCU (Read-Copy-Update) mechanism.

Memory removed from the cache is not returned to the allocator immediately, but only after the RCU timeout. This allows protected threads to copy data directly to user space without blocking counters. Page faults are disabled during RCU reads. In case of errors, the system simply falls back to the standard slow read path.

Test results

The tests were conducted on a laptop with an Intel Core i7-8565U processor (4 cores, 8 threads, ext4 file system).

When performing pread() reads of 16 bytes from a single cached page in 8 threads, throughput increased from 9.9–10.4 million to 30–33 million operations per second. The number of CPU cycles per read decreased from 2,937–2,975 to 725–726.

Torvalds emphasizes that these results are consistent only for a specific synthetic test and do not mean an automatic three-fold speedup of the entire system.

Risks and unresolved trade-offs

Despite the impressive speed, the development exposed a number of complex architectural problems.

Delayed page freeing makes them "invisible" to free memory calculation algorithms, which can lead to false decisions about lack of RAM (Out-Of-Memory).

When the RCU delay was intentionally disabled, the system read incorrect data, which proves the importance of strict control of the page "lifecycle".

Also found were issues with contiguous memory allocation and undefined behavior on the s390 architecture.

This patch series demonstrates AI-powered system software development, not autonomous kernel engineering. Impressive performance metrics require extensive testing, independent review, and remediation of documented correctness risks before being deployed to production.

The founder of Linux assured that nothing will prevent the release of version 7.2. When is it planned and what to expect
The founder of Linux assured that nothing will prevent the release of version 7.2. When is it planned and what to expect
On the topic
The founder of Linux assured that nothing will prevent the release of version 7.2. When is it planned and what to expect
Linux kernel developers have decided on an official position regarding AI code. What is its essence?
Linux kernel developers have decided on an official position on code written by AI. What is its essence?
On the topic
Linux kernel developers have decided on an official position on code written by AI. What is its essence?
Linux creator uses vibecoding for his pet project AudioNoise
Linux creator uses vibecoding for his pet project AudioNoise
On the topic
Linux creator uses vibecoding for his pet project AudioNoise
Read the country's main IT news in our Telegram
Read the country's main IT news in our Telegram
On the topic
Read the country's main IT news in our Telegram
Also Read
Roosh запускає нову освітню платформу AI HOUSE CLUB для ML/AI-спеціалістів та дата сайнтистів. Розповідаємо, як подати заявку та чому навчатимуть
Roosh запускає нову освітню платформу AI HOUSE CLUB для ML/AI-спеціалістів та дата сайнтистів. Розповідаємо, як подати заявку та чому навчатимуть
Roosh запускає нову освітню платформу AI HOUSE CLUB для ML/AI-спеціалістів та дата сайнтистів. Розповідаємо, як подати заявку та чому навчатимуть
Як нейромережі бачать вільну та незалежну Україну? Тест dev.ua
Як нейромережі бачать вільну та незалежну Україну? Тест dev.ua
Як нейромережі бачать вільну та незалежну Україну? Тест dev.ua
Нейронні мережі для генерації зображень бачать світ по-своєму, їхню логіку зрозуміти часом зовсім неможливо. Але таки хочеться. На честь Дня Незалежності України редакція dev.ua вирішила провести невеликий експеримент. Ми задали чотирьом різним нейронним мережам п’ять однакових запитів: «прапор України», «День Незалежності України», «український Крим», «перемога України» та «українці». Отриманими результатами ми ділимося з вами нижче.
У TikTok тепер можна генерувати фон за допомогою нейромережі. Ми протестували її та ділимося результатами
У TikTok тепер можна генерувати фон за допомогою нейромережі. Ми протестували її та ділимося результатами
У TikTok тепер можна генерувати фон за допомогою нейромережі. Ми протестували її та ділимося результатами
У TikTok з’явилася нова функція «Розумний фон». З її допомогою як фон для тіктоків можна підставляти згенеровані нейромережею зображення. Редакція dev.ua протестувала цю технологію і ділиться своїми враженнями.
1 comment
Які IT-спеціальності будуть потрібні в найближчі п'ять років? Ми з'ясували у голови американського стартапу ADAM Дениса Гурака
Які IT-спеціальності будуть потрібні в найближчі п'ять років? Ми з'ясували у голови американського стартапу ADAM Дениса Гурака
Які IT-спеціальності будуть потрібні в найближчі п'ять років? Ми з'ясували у голови американського стартапу ADAM Дениса Гурака

Have important news to share? Message our Telegram bot

Key events and useful links in our Telegram channel

Discussion
No comments yet.