Rust For Linux Kernel v9 Patches Trim Things Down Greatly For Easier Upstreaming

Written by Michael Larabel in Linux Kernel on 5 August 2022 at 01:53 PM EDT. 61 Comments
Earlier this week saw the Rust for Linux v8 patches posted that introduced a number of new abstractions and expanding the Rust programming language integration to more areas of the kernel. Those patches amounted to 43.6k lines of new code while "Rust for Linux v9" was posted today and comes in at just 12.5k lines of new code.

Rust for Linux v9 is significantly smaller than the prior patches due to removing a lot of extra features and integration. The hope is now to take a more initial minimal route with the Rust for Linux integration until that initial mainlining and then from there can build things up with the enhanced integration and allowing more involved review/feedback of the various abstractions and subsystem-specific patches.

Rust for Linux lead developer Miguel Ojeda commented with the v9 patches:
"This is a trimmed down v8. It has enough support to compile a minimal Rust kernel module, with the aim to get the "core" support in first and then start upstreaming the rest piece by piece.

The kernel module is able to create a `Vec` (a contiguous, growable array type), push some numbers and print them on unload to the kernel log with the `pr_info!` macro.

The patch series could be made even more minimal by removing some of that too, but this seemed like a good balance.

After the diet regime, 3% of the `kernel` crate remains (down to 500 lines), 60% of `alloc`, and the "adapt `alloc`" commit is 100 lines. Overall, we went from 40 to 13 klines.

Most of the code has been around in linux-next for some months now, but to trim down things I had to do minor changes. In any case, please let me know if this selection is in line with what you expected."

With the v9 patches being significantly less and sticking to the basics, it should be much easier to get clearance on mainlining it in a timely manner. Linus Torvalds has been wanting to merge it soon, so we'll see if this simplified work is now good enough that Linus Torvalds could go ahead and merge it over the next week for the Linux 6.0 merge window.

Rust could soon complement C as a supported language for Linux kernel driver development.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week