RBRD: Rust RAM block driver posted for Linux kernel review with safety gains, 19-22% write penalty
A Rust rewrite of Linux's BRD RAM disk driver enforces memory safety by preventing concurrent read-write page access, trading 19-22% write throughput and 2-10% read performance for elimination of undefined behavior.
Summary
Kernel developer patches posted Tuesday introduce RBRD, a Rust-language reimplementation of Linux's existing C-based BRD (RAM-backed block device) driver. RBRD creates virtual block devices in system memory, useful for testing and simulation scenarios where physical storage latency would skew results. Unlike its C predecessor, RBRD guarantees that no page can be read and written simultaneously, a constraint imposed by Rust's memory safety model that eliminates a class of undefined behavior vulnerabilities.
The safety mechanism carries measurable overhead. Single-threaded writes drop approximately 19% versus BRD, while eight-thread writes fall 22%. Reads degrade between 2% and 10% depending on workload parallelism. The developers acknowledge the gap has not been fully profiled and note that using a single device-wide lock rather than per-page locking pushes eight-thread reads 20-28% below BRD performance. The patch series is now on the Linux kernel mailing list for review; no target kernel release version has been specified.
Rust safety model vs. BRD performance characteristics
- Memory safety mechanism: RBRD prevents simultaneous read and write access to any page, enforcing Rust's aliasing rules that prohibit mutable and immutable references from coexisting, which eliminates undefined behavior possible in the C-based BRD driver.
- Write throughput penalty: Single-threaded writes measure approximately 19% slower than BRD, with eight-thread writes showing a 22% degradation under current benchmarking.
- Read throughput impact: Reads experience a 2-10% slowdown attributable to the synchronization required for Rust's safety guarantees.
- Locking granularity trade-off: The developers tested a single global device lock versus per-page locking; with the coarser lock, eight-thread reads were 20-28% slower than BRD, suggesting finer-grained synchronization may partially mitigate the overhead.
- Code maturity status: The patch series is in initial review on LKML with profiling incomplete; the developers state not all performance gap is necessarily attributable to the locking mechanism itself.
Why it matters
RBRD represents a concrete data point in the ongoing evaluation of Rust for Linux kernel driver development, demonstrating that memory safety guarantees can impose double-digit performance costs even in seemingly simple block I/O paths. For distribution kernel maintainers and developers choosing between BRD and RBRD, the trade-off will depend on whether workload integrity or raw throughput matters more; testing and CI pipelines may tolerate the slowdown, while high-frequency trading simulations or latency-sensitive temporary storage may stick with the C driver. The review discussion will likely influence how future Rust kernel drivers balance safety abstractions against performance expectations.
Original reference: www.phoronix.com →