Configurable CPU Cores
Longhorn now supports configurable CPU cores for the V2 data engine through the use of a CPU Mask. This mask allows you to define exactly which CPU cores are allocated to the engine, offering both global and per-node configuration options.
The CPU mask is a hexadecimal (hex) representation of a binary bitmask, where each bit corresponds to a specific CPU core.
Important: NVMe BDF Block Devices and I/O Queues
When using
nvmedisk driver for a block-type disk, SPDK unbinds the kernel NVMe driver and takes over the physical controller directly. SPDK allocates one I/O queue pair per allocated CPU core.Because of this, the physical NVMe device’s I/O queue count must be strictly greater than the number of SPDK CPU cores configured via the CPU mask.
If the CPU mask allocates as many or more cores than the available I/O queues on the physical device (for example, allocating 2 cores to an EBS NVMe volume that only provides 2 I/O queues), SPDK will exhaust the queues. This leads to incomplete I/O processing and causes volume I/O to hang indefinitely.
To determine the correct hex string, visualize your CPU cores as a sequence of bits from right to left:
| Desired No. of Cores | Binary Representation (Cores 3, 2, 1, 0) | Hexadecimal Value |
|---|---|---|
| 1 Core | 0001 | 0x1 |
| 2 Cores | 0011 | 0x3 |
| 3 Cores | 0111 | 0x7 |
| 4 Cores | 1111 | 0xF |
Example for 23 Cores: To allocate 23 cores, you need 23 bits set to 1.
111 1111 1111 1111 1111 11110x7FFFFFNote: Do not confuse the number of cores with the hex value. For instance, setting
0x4(Binary0100) only enables one core (Core #2), whereas0xF(Binary1111) enables four cores.
To set CPU cores globally across the cluster, update the data-engine-cpu-mask setting.
0xF).For node-specific CPU core allocation, update the spec.dataEngineSpec.v2.cpuMask field of the instance manager with a hexadecimal encoded string. By default, this value is empty, and the v2 data engine will use the global setting specified by data-engine-cpu-mask. When a per-node configuration is set, the v2 data engine will prioritize this value over the global setting for that specific node.
You can use a Binary to Hex Converter to help calculate your mask. Type a 1 for every core you wish to allocate and convert the resulting binary string to Hex.
Copyright © 2019-2026 Longhorn a Series of LF Projects, LLC. Documentation Distributed under CC-BY-4.0.
The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
For website terms of use, trademark policy and other project policies please see lfprojects.org/policies.