173
Expanding Volatile Memory Using
Persistent Memory
Persistent memory is treated by the kernel as a device. In a typical use-case, a persistent
memory-aware file system is created and mounted with the –o dax option, and files are
memory-mapped into the virtual address space of a process to give the application direct
load/store access to persistent memory regions.
A new feature was added to the Linux kernel v5.1 such that persistent memory
can be used more broadly as volatile memory. This is done by binding a persistent
memory device to the kernel, and the kernel manages it as an extension to DRAM. Since
persistent memory has different characteristics than DRAM, memory provided by this
device is visible as a separate NUMA node on its corresponding socket.
To use the MEMKIND_DAX_KMEM kind, you need pmem to be available using device
DAX, which exposes pmem as devices with names like /dev/dax*. If you have an existing
dax device and want to migrate the device model type to use DEV_DAX_KMEM, use:
$ sudo daxctl migrate-device-model
To create a new dax device using all available capacity on the first available region
(NUMA node), use:
$ sudo ndctl create-namespace --mode=devdax --map=mem
To create a new dax device specifying the region and capacity, use:
$ sudo ndctl create-namespace --mode=devdax --map=mem --region=region0
--size=32g
To display a list of namespaces, use:
$ ndctl list
If you have already created a namespace in another mode, such as the default fsdax,
you can reconfigure the device using the following where namespace0.0 is the existing
namespace you want to reconfigure:
$ sudo ndctl create-namespace --mode=devdax --map=mem --force -e namespace0.0
For more details about creating new namespace read https://docs.pmem.io/
ndctl-users-guide/managing-namespaces#creating-namespaces.
Chapter 10 Volatile Use of persistent MeMory
Précédent

- 197/457

Suivant