How To Verify Linux Kernel Support for Persistent Memory

How To Verify Linux Kernel Support for Persistent Memory

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
7407

// Count the number of enabled options
grep CONFIG_ /boot/config-`uname -r` | egrep "^CONFIG_" | wc -l
5691

// Count the number of commented (DISABLED) items
grep CONFIG_ /boot/config-`uname -r` | egrep "^\#" | wc -l
1716

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_X86_PMEM_LEGACY_DEVICE=y
CONFIG_X86_PMEM_LEGACY=m
CONFIG_ACPI_NFIT=m
# CONFIG_NFIT_SECURITY_DEBUG is not set
CONFIG_ZONE_DEVICE=y
# CONFIG_VIRTIO_PMEM is not set
CONFIG_LIBNVDIMM=m
CONFIG_BLK_DEV_PMEM=m
CONFIG_ND_BLK=m
CONFIG_ND_CLAIM=y
CONFIG_ND_BTT=m
CONFIG_BTT=y
CONFIG_ND_PFN=m
CONFIG_NVDIMM_PFN=y
CONFIG_NVDIMM_DAX=y
CONFIG_NVDIMM_KEYS=y
CONFIG_DAX_DRIVER=y
CONFIG_DAX=y
CONFIG_DEV_DAX=m
CONFIG_DEV_DAX_PMEM=m
CONFIG_DEV_DAX_KMEM=m
# CONFIG_DEV_DAX_PMEM_COMPAT is not set
CONFIG_FS_DAX=y
CONFIG_FS_DAX_PMD=y
CONFIG_ARCH_HAS_PMEM_API=y

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.

Summary

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.

How I Created a Custom ChatGPT Trained on the CXL Specification Documents

How I Created a Custom ChatGPT Trained on the CXL Specification Documents

If you’re working with Compute Express Link (CXL) and wish you had an AI assistant trained on all the different versions of the specification—1.0, 1.1, 2.0, 3.0, 3.1… you’re in luck.

Whether you’re a CXL device vendor, a firmware engineer, a Linux Kernel developer, a memory subsystem architect, a hardware validation engineer, or even an application developer working on CXL tools and utilities, chances are you’ve had to reference the CXL spec at some point. And if you have, you already know: these documents are dense, extremely technical, and constantly evolving.

Read More
How Much RAM Could a Vector Database Use If a Vector Database Could Use RAM

How Much RAM Could a Vector Database Use If a Vector Database Could Use RAM

Featured image generated by ChatGPT 4o model: “a low poly woodchuck by a serene lake, surrounded by mountains and a forest with tree leaves made from DDR memory modules. The woodchuck is munching on a memory DIMM. The only memory DIMM in the image should be the one being eaten.”

How Much RAM Could a Vector Database Use If a Vector Database Could Use RAM?

Although the title is a punn from the famous “woodchuck rhyme,” the question is serious for LLM applications using vector databases. As large language models (LLMs) continue to evolve, leveraging vector databases to store and search embeddings is critical. Understanding the memory usage of these systems is essential for maintaining performance, response times, and ensuring system scalability.

Read More
Resolving commands 'Killed' on GCP f1-micro Compute Engine instances

Resolving commands 'Killed' on GCP f1-micro Compute Engine instances

When I want to perform a quick task, I generally spin up a Google GCP Compute Engine instance as they’re cheap. However, they have limited resources, particularly memory. When refreshing the package repositories, it’s quite easy to encounter an Out-of-Memory (OOM) situation which results in the command - yum or dnf - is ‘killed’. For example:

$ sudo dnf update 
CentOS Stream 8 - AppStream                                                                                                  8.3 MB/s |  18 MB     00:02    
CentOS Stream 8 - BaseOS                                                                                                      13 MB/s |  16 MB     00:01    
CentOS Stream 8 - Extras                                                                                                      69 kB/s |  16 kB     00:00    
Google Compute Engine                                                                                                         20 kB/s | 9.4 kB     00:00    
Google Cloud SDK                                                                                                              24 MB/s |  43 MB     00:01    
Killed

dmesg has a lot of information about the situation, but the key line to confirm dnf caused the OOM event, is:

Read More