Skip to main content

Module numa

Module numa 

Source
Expand description

NUMA-aware memory allocation utilities.

This module provides utilities for NUMA-aware memory allocation, which is critical for optimal performance on multi-socket systems with GPUs. Memory allocated on the NUMA node closest to the target GPU has significantly lower access latency.

§Architecture

  • NumaNode: Represents a NUMA node ID
  • topology: Reads CPU-to-NUMA mapping from /sys/devices/system/node
  • worker_pool: Dedicated worker threads pinned to specific NUMA nodes

§Usage

NUMA optimization is opt-in via environment variable:

export DYN_KVBM_ENABLE_NUMA=1

When enabled, pinned memory allocations are routed through NUMA workers that are pinned to the target GPU’s NUMA node, ensuring first-touch policy places pages on the correct node.

Modules§

topology
NUMA topology detection
worker_pool
NUMA worker pool for memory allocation with first-touch policy.

Structs§

NumaNode
Represents a NUMA node identifier.

Functions§

get_current_cpu_numa_node
Get the current CPU’s NUMA node.
get_device_numa_node
Get NUMA node for a GPU device.
is_numa_enabled
Check if NUMA optimization is enabled via environment variable
pin_thread_to_numa_node
Pin the current thread to a specific NUMA node’s CPUs.