How To Verify Linux Kernel Support for Persistent Memory
Posted on January 4, 2023 • 2 minutes
Linux Kernel support for persistent memory was first delivered in version 4.0 of the mainline kernel, however, it was not enabled by default until version 4.2.
If you use a Linux distribution that uses kernel 4.2 or later, or the distro backports features in to an older kernel, you will almost certainly have persistent memory support enabled by default. It is still worth verifying what features are enabled and disabled as this may vary by distro and release version for the very latest persistent memory features.
If you build your own Kernel and require persistent memory feature support, you’ll need to ensure you configure the Kernel correctly.
We’ll use Fedoro for this article, but the process is the same or very similar for other Linux distro’s. Fedora stores the kernel configuration file in
/boot/config-<kernel_version>.<Fedora_release>.<architecture>. For example, on an x64 Intel server running Fedora 30 with Kernel 5.3.18-200.fc30.x86_64, the config file is
/boot/config-5.3.18-200.fc30.x86_64. This file is automatically generated and it is not recommended to edit it directly as it’ll get overwritten or replaced when you update the kernel. Read Changing Fedora Kernel Configuration Options
for more information on how the config file is generated and how you can make changes to the kernel options.
The config file is a plain text document that we can view to see what features are enabled or disabled. For this particular system, there’s a total of 7,407 configurable entries of which 1,716 are currently commented out (disabled).
// Count the number of configurable options
grep CONFIG_ /boot/config-`uname -r` | wc -l
// Count the number of enabled options
grep CONFIG_ /boot/config-`uname -r` | egrep "^CONFIG_" | wc -l
// Count the number of commented (DISABLED) items
grep CONFIG_ /boot/config-`uname -r` | egrep "^\#" | wc -l
To look for the persistent memory specific configuration options, use:
# egrep -i "CONFIG_ZONE_DEVICE|NFIT|PMEM|_ND_|BTT|NVDIMM|DAX" /boot/config-`uname -r`
# CONFIG_NFIT_SECURITY_DEBUG is not set
# CONFIG_VIRTIO_PMEM is not set
# CONFIG_DEV_DAX_PMEM_COMPAT is not set
Note: Over time, the name of the configuration option has changed, and may change again in the future. As such, the
egrep filter may not produce an accurate or exhaustive list.
This article focused on what persistent memory related configuration options to look for within the kernel config file. This allows custom kernel builders to enable the necessary features, and for anyone running production systems to verify what features are enabled in your kernel.