Exposing storage devices as memory
As things stand now, he said, there are two ways of exposing a storage device as memory: adding it as a swap device, or allowing applications to directly map the device into their address space. But, as memory-like as these devices are, they still do not have the same access times as dynamic RAM and, despite improvements, they still do not have the same write endurance. So he is not sure that making them look like ordinary memory is the correct model.
He has a different idea: extend the virtual-memory idea to provide access
to memory-like storage devices. Each device would have some ordinary RAM
allocated for it; that memory would be used as a cache for data stored in
the device itself. That device is represented in the kernel by a simple
character device
(/dev/umap) that would allow an application to map a portion of
the storage device's space into its address space. The primary purpose of
/dev/umap is to
catch page faults; it can respond to them by moving data between the RAM
cache and the storage device.
The developers in the room thought that this arrangement looked a lot like using the storage device as a swap area; Manzanares responded that he didn't want to use the existing swap mechanism because it depends on the block layer, which he thinks is expensive and wants to avoid. Just using the page cache also lacks appeal, he said; it is too memory-intensive and does not give applications enough control. As it is, he said, /dev/umap outperforms both the memory-mapping and swapping alternatives.
Dan Williams suggested that, rather than creating a completely new mechanism
for accessing this memory, it would be better to start with the existing
filesystem APIs and the page cache and, if necessary, trim them down. Dave
Hansen said that the kernel has a hard time just managing the memory types
it supports now; adding another is unlikely to make things better. The
discussion circled around these points for a while but, as the session came
to a close, it was clear that /dev/umap would have a hard time
getting upstream in its current form.
| Index entries for this article | |
|---|---|
| Conference | Storage, Filesystem, and Memory-Management Summit/2018 |