The Rust for Linux v8 patch, released earlier this week, introduced a number of abstractions and extended Rust programming language integration to more parts of the kernel. v8, Phoronix noted, had 43.6k lines of code, while today’s new “Rust for Linux v9 “, which introduces only 12.5k new lines of code.
Rust is expected to complement the C language as a new language to support Linux kernel driver development.
Rust for Linux v9 is much smaller than previous patches due to the removal of many additional features and integrations. By sticking to a more initial “minimalist route”, it is expected to bring more positive changes to the mainline kernel.
In addition to enhanced integration and build transactions, it allows for specific patches to various abstractions and subsystems, drawing more people into the code review and feedback process. Lead developer Miguel Ojeda commented.
"As a 'lite' version of the v8 patch, v9 provides enough support for compiling a minimal Rust kernel module - to be the first to get 'core' support and to start gradually 'upstreaming' the rest. The kernel module can create a 'vector' as a continuous, growable array type that can push some numbers and print them to the kernel log using the 'pr_info!' macro when unloaded."
The new patch series can also be made smaller by removing some of its content, and so far it seems to have struck a good balance.
"This resulted in 3% kernel crate retention (reduced to 500 lines), 60% alloc and adapt alloc commits (100 lines), and an overall reduction from 40k to 13k lines. Although most of the code has been in linux-next for several months, we had to make minor changes to reduce some of the content, and finally we welcome your positive feedback on whether this option meets your expectations."
Phoronix notes that with the significantly leaner patch volume of v9, it is expected to be easier to get a mainline license than before.
Linus Torvalds has been hoping to complete the merger as soon as possible (next week’s Linux 6.0 merger window) and will follow up to see if the work has been good enough.