6

New DRAM-less NVME SSDs use a portion of the system memory as HMB (Host memory buffer).

How can I check / change NVME HMB on Linux?
(to verify it is working correctly or alter its behavior)

1 Answer 1

4

According to the NVMe base specification 2.0a, the NVME feature ID for the Host Memory Buffer is 0x0d. You can check it with the nvme get-feature command:

# nvme get-feature /dev/nvme0 -H -f 0x0d
get-feature:0xd (Host Memory Buffer), Current value:0x000001
        Memory Return       (MR): False
        Enable Host Memory (EHM): Enabled
        Host Memory Descriptor List Entry Count (HMDLEC): 10
        Host Memory Descriptor List Address     (HMDLAU): 0x0
        Host Memory Descriptor List Address     (HMDLAL): 0xffff7000
        Host Memory Buffer Size                  (HSIZE): 9728

You can also find some information under /sys/class/nvme/, in the directory of the respective NVMe controller.

The nvme kernel module also has the max_host_mem_size_mb parameter which you can use to limit the maximum HMB size per controller.

Another nvme module parameter, use_cmb_sqes can be used to forbid the use of controller's memory buffer for I/O SQes. Assuming I've understood this correctly, this could be used to make any NVMe work like a DRAM-less one.

You can find the current values for the module parameters at /sys/module/nvme/parameters/, and also change some of them dynamically from there.

2
  • 1
    The NVMe base specification says: "Host Memory Buffer Size (HSIZE): This field specifies the size of the host memory buffer allocated in memory page size (CC.MPS) units." The typical basic memory page size in x86 hardware is 4 KiB, so you'll have to multiply the HSIZE by 4096 to get the HMB size in bytes.
    – telcoM
    Dec 13, 2021 at 5:34
  • If I'm reading this correctly, you configure max_host_mem_size_mb to force the SSD to take up much more host memory? Could one increase this to the size of a typical DRAM on high end drives to emulate the performance on an HMB enabled drive? Has anyone tried this? Aug 1, 2022 at 15:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .