Rust-Powered RAM Disks Move Closer to the Linux Kernel With New rbrd Driver
Linux kernel developers have proposed a new RAM-backed block device driver written in Rust, expanding the language's role in low-level storage infrastructure. Submitted on November 17, 2026, the patch series introduces rbrd, an experimental driver that stores block device data directly in system memory while using Rust's safety model to address concurrency problems found in conventional implementations.
The proposal comes from developer Vitaly Wool and builds on the existing Rust null block driver, known as rnull. Unlike a null device that discards written data, rbrd provides actual storage by allocating memory pages when applications write to the device. It supports reading, writing, and discarding blocks, allowing it to behave like a conventional RAM disk through the Linux block layer.
One of the project's most important design decisions is preventing simultaneous reads and writes to the same memory page. The existing C-based brd driver permits certain overlapping operations that can produce inconsistent reads, while the proposed Rust implementation serializes access to individual pages. The result is a different balance between performance and data consistency, demonstrating how Rust can influence the design of Linux kernel drivers.
The driver has not yet been merged into the mainline Linux kernel. Its initial submission is a three-patch RFC-style development proposal that introduces both the driver and additional Rust abstractions required to support real block I/O operations.
Linux Gains Another Experimental Rust Storage Driver
The Linux kernel has supported RAM-backed block devices for many years. These devices expose a region of system memory as a block storage device, allowing filesystems and applications to interact with RAM using interfaces normally associated with disks or solid-state drives.
A RAM disk can be formatted with a filesystem, mounted, and accessed through standard file operations. Because its contents reside in memory, it avoids the physical storage latency associated with conventional devices. However, the data is volatile and disappears when the device is destroyed or the system loses power.
Linux already provides the C-based brd driver for this purpose. The new rbrd implementation is not intended to introduce RAM disks as an entirely new capability. Instead, it demonstrates how the same general functionality can be implemented using Rust and the kernel's developing Rust block-layer interfaces.
The proposal is especially interesting because Rust support in Linux has gradually expanded from foundational abstractions into increasingly functional drivers. A RAM-backed block device exercises more of the kernel's storage infrastructure than a simple example module because it must process real I/O requests, manage memory pages, and coordinate concurrent operations.
The new driver is therefore both a functional storage implementation and a practical test of Rust's ability to support more demanding kernel subsystems.
Building on the Rust Null Block Driver
The development of rbrd follows earlier work on rnull, a Rust implementation of a null block device.
Null block devices are commonly used for testing and benchmarking the Linux block layer. They can accept requests without storing data on physical media, allowing developers to measure software overhead and exercise I/O paths without involving an actual storage device.
However, a null driver requires only a limited subset of the functionality needed by a real storage implementation. It can complete requests without transferring application data into persistent or temporary backing storage.
A RAM-backed driver has additional responsibilities. It must determine whether an I/O request represents a read or write, locate the memory buffers associated with that request, calculate storage offsets, and copy data between application buffers and the device's memory pages.
The existing Rust block-layer abstractions did not provide all these capabilities. As a result, the new proposal introduces supporting interfaces before adding the driver itself.
The three-patch series includes extensions for accessing block I/O requests and their associated memory segments, new page-management functionality, and finally the rbrd driver.
This staged approach is important because kernel developers must review not only whether a particular driver works, but also whether the reusable abstractions it introduces are appropriate for other Rust drivers.
New Rust Block-Layer Interfaces Enable Real Data Transfers
The first patch extends Rust support for the Linux multiqueue block layer, commonly called blk-mq.
The blk-mq infrastructure is responsible for managing storage requests across multiple software and hardware queues. It is widely used by modern Linux storage drivers because it supports parallel I/O processing and reduces contention associated with older single-queue designs.
For a RAM-backed block driver, handling a request requires access to its operation type, starting sector, data length, and associated buffers.
The proposal introduces a Rust Bio wrapper and interfaces for iterating through the segments that make up a block I/O request.
In Linux, a bio represents a block I/O operation and describes the memory involved in transferring data. A single request can contain multiple bios, and each bio may contain multiple memory segments.
A driver therefore needs to process these structures carefully, particularly when a segment crosses the boundary between two pages of the backing storage.
The proposed Rust interfaces allow the driver to inspect these segments without forcing every driver to reimplement the underlying C block-layer interactions.
This is a significant step because the abstractions could eventually support other Rust storage drivers that need to transfer actual data rather than simply acknowledge requests.
Memory Pages Are Allocated Only When Needed
Like the existing brd driver, rbrd uses demand-based memory allocation.
When a RAM disk is created, the driver establishes its logical capacity, but it does not immediately allocate all the memory required to store that capacity as data pages. Instead, pages are allocated when the device receives writes to previously unused regions.
For example, a RAM disk configured with a capacity of 512 MiB does not necessarily consume 512 MiB of physical memory immediately after creation. Its actual data-page consumption increases as applications write to different parts of the device.
If an application reads from a region that has never been written, the driver returns zero-filled data.
This behavior is useful because it allows applications to treat unwritten regions as initialized storage without requiring the driver to allocate physical memory for every block in advance.
The design also supports discard operations. When the driver receives a discard request covering complete backing pages, those pages can be released, reducing the memory used by the device.
There is an important distinction between logical capacity and physical memory consumption. The device reserves metadata to track its potential pages, so it still has an upfront memory cost even before application data is written.
A Flat Atomic Page Array Replaces the Traditional XArray
One of the most interesting architectural differences between rbrd and the existing C implementation concerns how memory pages are tracked.
The conventional brd driver uses an XArray, a kernel data structure designed to efficiently associate integer indexes with pointers or other values. XArrays are useful when storing sparse collections of objects because they can grow dynamically as entries are added.
The proposed Rust driver takes a different approach. It allocates a flat array of atomic page pointers when the RAM disk is activated.
Each array entry corresponds to a potential memory page within the device. An empty entry indicates that the corresponding storage region has not been allocated or has been discarded.
For a system using 4 KiB memory pages, a 512 MiB RAM disk contains 131,072 potential page positions. On a 64-bit system with eight-byte pointers, the array requires approximately 1 MiB of metadata before accounting for other structures.
This introduces a predictable memory overhead that scales with the configured capacity of the device.
The advantage is that page lookup can be performed directly through an array index. The driver does not need to traverse a dynamically allocated tree structure to locate the relevant slot.
The array also allows the implementation to use atomic operations for inserting, locating, and removing pages without taking a conventional lock around the page index itself.
Atomic Operations Help Avoid Global Lock Contention
The proposed driver uses atomic pointer operations to coordinate access to its page array.
When a write targets a region without an allocated page, the driver attempts to install a new page pointer using a compare-and-exchange operation. This ensures that only one competing operation successfully installs its page into the slot.
When a discard removes a page, the driver exchanges the existing pointer with a null value.
Page lookup uses a speculative reference-counting operation followed by another check that the array entry still refers to the same page. This helps prevent the driver from using a page that another operation has removed.
These mechanisms are important because storage workloads can involve many threads issuing requests simultaneously. A single global lock protecting every page lookup could become a source of contention, particularly on systems with many CPU cores.
By using atomic operations for the page index, rbrd allows independent operations to proceed without serializing all requests through one shared lock.
However, lock-free page lookup does not mean that the entire driver operates without synchronization.
The actual copying of data into or out of a page uses a separate mechanism to preserve consistency when multiple operations target the same memory.
Per-Page Locking Prevents Torn Reads
The most important correctness improvement in rbrd is its handling of overlapping reads and writes.
The existing C-based RAM block driver can permit a read operation to access a memory page while another operation is writing to it. Under certain conditions, the reader may observe a mixture of old and new data.
This behavior is known as a torn read.
Consider a page containing a sequence of bytes representing an older version of a data block. If one thread begins replacing those bytes while another thread reads the same page, the reader could observe some bytes before the update and others after it.
The resulting data would not correspond to either complete version of the page.
The proposed Rust implementation avoids this situation by serializing data copies using a bit spinlock stored in the page's private metadata.
Only one operation can copy data to or from a particular page while holding that lock.
This means a read cannot overlap a write to the same page during the protected copy operation, preventing the torn-read behavior described in the patch submission.
The design does not turn a RAM disk into a transactional database or guarantee atomicity across multiple pages. It specifically improves consistency for operations that access the same backing page.
Why Rust Makes the Concurrency Problem More Important
Rust's memory safety model places strong restrictions on how mutable memory can be accessed concurrently.
In ordinary safe Rust, the language prevents code from creating incompatible shared and mutable references to the same data. These restrictions help eliminate many classes of memory corruption and data races before a program is executed.
Kernel development is more complicated because drivers interact with hardware, raw pointers, memory-mapped structures, and interfaces originally written in C.
Some low-level operations therefore require carefully reviewed unsafe Rust code. The goal is not to eliminate every unsafe operation, but to isolate it behind abstractions that enforce valid usage.
In the case of rbrd, allowing unsynchronized reads and writes to the same memory page would create problems for Rust's memory model in addition to the possibility of inconsistent data.
The per-page locking strategy provides the synchronization required to make the memory access pattern valid.
This illustrates an important aspect of Rust adoption in the Linux kernel. Rust does not automatically make a driver safe merely because its source files use the .rs extension.
Developers must still design correct synchronization, ownership, lifetime management, and error handling.
The language can make these requirements more explicit and easier to enforce, but the underlying engineering decisions remain essential.
Performance Testing Reveals the Cost of Stronger Synchronization
The new consistency guarantees introduce a measurable performance tradeoff. In preliminary benchmarks included with the patch submission, rbrd performs similarly to the existing C driver for highly parallel reads, but it is slower in some single-threaded and write-intensive workloads.
The developer tested 4 KiB random direct I/O using an eight-vCPU virtual machine, averaging the results across nine runs.
| Benchmark | C brd |
Rust rbrd |
Difference |
|---|---|---|---|
| Random reads, 8 threads | 2,048 kIOPS | 2,012 kIOPS | -2% |
| Random reads, 1 thread | 512 kIOPS | 463 kIOPS | -10% |
| Random writes, 1 thread | 583 kIOPS | 470 kIOPS | -19% |
The results indicate that the Rust driver can approach the performance of the established implementation under parallel read workloads. However, the additional synchronization and memory-management requirements introduce overhead, particularly during writes.
These numbers should not be interpreted as a universal comparison between Rust and C. The two implementations use different data structures and concurrency policies, making it difficult to isolate the programming language as the cause of a particular performance difference.
The benchmark also measures an early implementation rather than a fully optimized production driver. Further changes to synchronization, memory allocation, and request handling could affect the results.
For kernel developers, the more important question is whether the improved consistency guarantees justify the performance cost and whether the implementation can be optimized without weakening those guarantees.
Multiqueue Processing Uses One Hardware Queue per CPU
The proposed driver integrates with Linux's multiqueue block infrastructure through a configuration that creates one hardware queue for each available CPU.
Although rbrd does not communicate with a physical storage controller, it uses the same block-layer abstractions as hardware-backed drivers. This allows the kernel to distribute requests across multiple queues and process them using familiar storage interfaces.
Each queue has a depth of 32 requests. Because requests are completed synchronously within the driver's request handler, the implementation does not need the large queue depths associated with some physical storage devices.
The per-CPU queue arrangement also avoids automatically attaching the mq-deadline I/O scheduler in the configuration described by the developer.
This is appropriate for the driver's intended operation because RAM-backed storage does not have mechanical seek times or the same command scheduling characteristics as physical disks.
The driver processes requests through its queue_rq() implementation, which examines the operation and dispatches it to the corresponding storage routine.
Supported commands include reading, writing, discarding, and flushing. The flush operation requires no physical cache synchronization because the stored data already resides in system memory.
Unsupported operations return an error rather than silently behaving as though they succeeded.
Nonblocking Memory Allocation Handles I/O Pressure
A RAM-backed block device must allocate memory while processing write requests, but allocation behavior becomes complicated when the driver operates in a context where sleeping is not permitted.
The proposed rbrd implementation uses GFP_NOWAIT for memory allocations performed in its I/O path.
This tells the kernel not to wait for memory to become available through operations that could block the current execution context.
If a required allocation cannot be completed immediately, the driver reports a resource-related failure to the block layer. The block infrastructure can then retry the request when resources become available.
This behavior is important because the driver must respect the execution constraints imposed by the multiqueue storage subsystem.
Blocking unexpectedly inside a request handler can create scheduling problems or deadlocks, particularly when memory allocation depends on other kernel operations making progress.
The proposal therefore separates the allocation behavior used during device initialization from the more restrictive allocation requirements of active I/O processing.
The design also highlights why a functional storage driver is a useful test for Rust kernel abstractions. It must handle resource exhaustion, partial initialization, concurrency, and cleanup correctly rather than simply demonstrating successful operation under ideal conditions.
Devices Are Configured Through configfs
Polo-like graphical configuration is not involved here; rbrd uses configfs, a kernel interface that allows administrators to create and configure certain kernel objects through a filesystem.
The proposed driver registers its configuration under:
/sys/kernel/config/rbrd/
Each RAM disk is represented by a directory containing attributes that control its size, block size, and activation state.
The available attributes are:
-
size, the logical device capacity in MiB. -
blocksize, the logical and physical block size. -
power, which activates or deactivates the device.
The default configuration specifies a 64 MiB device with a 512-byte block size.
Unlike a static module parameter that applies to every instance, configfs allows administrators to define individual devices and configure them before activation.
This makes the driver suitable for testing different capacities and storage configurations without repeatedly loading the module with new global parameters.
The interface is part of the proposed implementation and is not yet available in ordinary mainline Linux installations.
Creating a RAM Disk With the Proposed Driver
On a kernel built with the experimental rbrd patch series and the required Rust and configfs support, a RAM-backed block device can be created through the driver's configuration interface.
The following example creates a 512 MiB RAM disk.
First, ensure configfs is mounted:
sudo mount -t configfs configfs /sys/kernel/config
This command is unnecessary if configfs is already mounted. Next, create a device configuration directory:
sudo mkdir /sys/kernel/config/rbrd/rram0
Set the logical capacity:
echo 512 | sudo tee /sys/kernel/config/rbrd/rram0/size
Activate the device:
echo 1 | sudo tee /sys/kernel/config/rbrd/rram0/power
If initialization succeeds, the driver creates a block device at:
/dev/rram0
Administrators can inspect it with:
lsblk /dev/rram0
The device can then be used with ordinary block-storage tools. For example, a test filesystem can be created with:
sudo mkfs.ext4 /dev/rram0
These commands are intended for an isolated development environment running a kernel that includes the proposed driver. They will not work on a standard Linux installation without that support.
Formatting also destroys any existing filesystem data on the selected block device. Users should verify the device name carefully before running filesystem creation commands.
RAM Disk Data Disappears When the Device Is Deactivated
A critical characteristic of rbrd is that its contents are temporary.
The driver stores data in volatile system memory rather than persistent storage. When the device is powered off, its backing pages are released and the data disappears.
For example, after unmounting a test filesystem, the device can be deactivated with:
echo 0 | sudo tee /sys/kernel/config/rbrd/rram0/power
This removes the corresponding block device and releases its allocated storage.
If the same configuration is activated again, the new device does not recover the previous contents.
The same limitation applies when the driver module is unloaded or the system shuts down.
This makes rbrd suitable for temporary storage, development experiments, and block-layer testing, but unsuitable for information that must survive a reboot unless the data is copied to persistent storage beforehand.
It is also important to distinguish a RAM-backed block device from a conventional tmpfs filesystem. Both use memory, but they operate at different layers of the Linux storage architecture.
RAM Disks Versus tmpfs and zram
Linux already provides several ways to use system memory for temporary storage. The proposed Rust driver adds another implementation option rather than replacing those existing technologies.
A traditional RAM disk exposes a block device that can be formatted with a filesystem. Applications then access files through the filesystem, while the kernel translates those operations into block I/O requests.
By contrast, tmpfs is a memory-backed filesystem that does not require creating or formatting a separate block device.
For example, administrators can create a temporary filesystem using:
sudo mkdir -p /mnt/test-tmpfs
sudo mount -t tmpfs -o size=512M tmpfs /mnt/test-tmpfs
This creates a filesystem with a configured size limit of 512 MiB, without involving a RAM block driver.
Linux also provides zram, which creates compressed RAM-backed block devices. It is commonly used for compressed swap space, allowing memory pages to be compressed before being stored in RAM.
The main distinctions are:
| Technology | Interface | Typical purpose |
|---|---|---|
brd |
RAM-backed block device | Storage and filesystem testing |
rbrd |
Experimental Rust block device | Rust block-layer development and testing |
tmpfs |
Memory-backed filesystem | Temporary files and application data |
zram |
Compressed RAM block device | Compressed swap and memory efficiency |
The technologies overlap in some use cases, but they are not interchangeable in every situation.
For example, a developer testing block-layer behavior may specifically require a block device, making brd or rbrd more appropriate than tmpfs.
A desktop user seeking temporary file storage, however, will generally find tmpfs simpler because it does not require managing a separate block device and filesystem.
The Driver Introduces New Rust Page-Management Abstractions
The second patch in the series extends Rust's ability to work with kernel memory pages.
The proposed interfaces include reference-counting operations, conversions between page objects and raw pointers, and a mechanism for acquiring a bit spinlock stored in page-private metadata.
These capabilities are necessary because the RAM driver maintains an array of raw page pointers while allowing concurrent operations to locate and release those pages.
The reference-counting implementation helps ensure that a page remains valid while a request accesses it.
Without appropriate lifetime management, a discard operation could release a page while another thread is attempting to read from it, creating a use-after-free vulnerability.
The new abstractions are intended to make these operations available through carefully defined Rust interfaces.
This work may eventually benefit drivers beyond rbrd, since memory page ownership and synchronization are common requirements in kernel storage and memory-management code.
However, reusable abstractions also require careful review. An interface that is convenient for one driver must still be sufficiently general and safe for other kernel components.
The patch review process will therefore need to evaluate the page-management APIs independently of the RAM disk implementation.
Why This Matters for Rust-for-Linux
The introduction of rbrd reflects the continuing expansion of the Rust-for-Linux effort.
Rust support entered the mainline Linux kernel to make it possible to develop selected kernel components using a language designed to prevent many memory-safety errors.
However, supporting Rust drivers requires more than enabling the compiler. The kernel must provide abstractions for memory allocation, reference counting, synchronization, device registration, error handling, and subsystem-specific operations.
The Rust null block driver demonstrated that the block layer could expose basic request-processing interfaces to Rust code.
The new RAM-backed driver extends that work by requiring actual data transfers, dynamic memory allocation, and concurrent access to stored data.
This progression is significant because it moves Rust support toward more realistic driver workloads.
A successful RAM block driver does not prove that every storage driver can immediately be rewritten in Rust. Hardware drivers must also handle device-specific protocols, DMA, interrupts, firmware, error recovery, and complex asynchronous behavior.
Nevertheless, rbrd provides a useful intermediate step between a minimal example driver and more complicated storage implementations.
Rust Does Not Eliminate the Need for Performance Engineering
The benchmark results also provide a reminder that memory safety and performance must be considered together.
Rust can prevent many programming errors through its type system and ownership rules, but it does not automatically select the most efficient data structures or synchronization mechanisms.
In rbrd, the developer deliberately chooses stronger per-page synchronization than the existing C implementation.
That decision prevents torn reads, but it also introduces additional work during I/O processing.
The resulting performance difference is therefore partly a consequence of the driver's consistency model.
A more useful comparison would examine the two implementations under equivalent correctness guarantees, rather than assuming that every difference comes from the programming language.
Future optimization could explore reducing synchronization overhead, improving memory allocation behavior, or refining how requests are divided across page boundaries.
Any such optimization would need to preserve the memory-safety and data-consistency properties that motivate the current implementation.
The proposal provides an opportunity for kernel developers to evaluate these tradeoffs using a relatively small and understandable storage driver.
The Driver Is Still Under Review
As of November 18, 2026, rbrd remains a proposed addition to the Linux kernel.
The patch series was submitted to the Linux kernel, block-layer, memory-management, and Rust-for-Linux mailing lists for review.
The driver is marked experimental through the kernel configuration option:
CONFIG_BLK_DEV_RUST_RAM
It depends on Rust support and configfs being enabled in the kernel.
The proposed configuration also advises users who are uncertain about the feature to leave it disabled.
Before the driver can be merged, maintainers will need to evaluate the correctness of its memory-management abstractions, concurrency handling, block-layer integration, and overall design.
Reviewers may request changes to the driver itself or to the reusable APIs introduced by the first two patches.
The submission does not establish a confirmed merge date or guarantee inclusion in a particular Linux kernel release.
Even if the driver is accepted, distributions may choose not to enable an experimental RAM block driver in their default kernel configurations.
For now, the implementation is primarily relevant to kernel developers, Rust contributors, and users who build custom kernels for testing.
What the Proposal Means for Linux Storage Development
The practical significance of rbrd extends beyond its immediate usefulness as a RAM disk.
Linux storage drivers operate in one of the most demanding parts of the kernel. They must handle concurrent requests, manage memory carefully, preserve data consistency, and recover correctly from resource failures.
These requirements make the block layer an important environment for evaluating Rust's suitability for systems programming.
The proposed driver demonstrates that Rust can be used to implement a functional block device with demand-allocated storage, atomic page management, discard support, and multiqueue request processing.
It also exposes areas where the Rust kernel infrastructure still needs additional abstractions.
The performance results are valuable because they provide measurable information about the costs of the selected implementation. Rather than assuming that Rust will automatically improve or degrade performance, developers can examine the actual behavior of a working driver.
If the abstractions prove useful and the implementation passes review, the work could make it easier to develop more sophisticated Rust storage drivers in the future.
Conclusion
The proposed rbrd Rust RAM block driver represents another step toward expanding Rust support in the Linux kernel's storage infrastructure. Submitted on November 17, 2026, the three-patch series introduces a functional RAM-backed block device along with new abstractions for block I/O and memory page management.
The driver follows the general behavior of Linux's existing C-based brd implementation, allocating pages on demand, returning zeros for unwritten regions, and releasing complete pages during discard operations. Its design differs through the use of a flat array of atomic page pointers and per-page synchronization that prevents overlapping reads and writes from producing torn data.
Initial benchmarks show that these stronger consistency guarantees come with performance costs, particularly for write operations. However, the results also demonstrate that the Rust implementation can approach the established driver's throughput in some parallel read workloads.
The project remains experimental and has not been merged into the mainline kernel. Its immediate value lies in testing Rust's developing block-layer interfaces and providing a concrete implementation that kernel maintainers can review, benchmark, and improve.
For the broader Linux ecosystem, rbrd illustrates how Rust adoption is progressing from foundational language support toward increasingly capable kernel drivers. Its future will depend on technical review and continued development, but the proposal already provides a useful demonstration of how memory safety, concurrency, and storage performance intersect inside the Linux kernel.
