Reading NUMA Topology without numactl
Reading NUMA Topology without numactl
Thesis
NUMA (Non-Uniform Memory Access) means memory attached to one socket is faster for CPUs on that socket. Before you pin threads or blame “memory latency”, read the topology. You do not need numactl for a first look: sysfs under /sys/devices/system/node/ and /proc/zoneinfo are enough. This chapter inspects a single-node VM and shows what multi-node output would add.
Mental model
node0: CPUs 0-7, local DRAM
node1: CPUs 8-15, local DRAM
cross-node load → higher latency / lower bandwidth
Worked examples
numactl is not installed here (and we will not install packages for a chapter). Read-only sysfs:
ls /sys/devices/system/node/
cat /sys/devices/system/node/node0/meminfo | head
cat /sys/devices/system/node/node0/cpulist
head -40 /proc/zoneinfoOutput (trimmed) from this run:
has_cpu
has_generic_initiator
has_memory
has_normal_memory
node0
online
possible
power
uevent
== node0 ==
Node 0 MemTotal: 16386368 kB
Node 0 MemFree: 5183212 kB
Node 0 MemUsed: 11203156 kB
Node 0 SwapCached: 0 kB
Node 0 Active: 1525412 kB
Node 0 Inactive: 5364312 kB
Node 0 Active(anon): 1372 kB
Node 0 Inactive(anon): 3180496 kB
cpus: 0-7
This guest is one NUMA node (node0, CPUs 0-7, ~16 GiB). That is normal for small VMs — the skill is confirming it before applying multi-node tuning guides.
Trap
Copying numactl --interleave=all folklore onto a single-node machine. Interleave policies matter when remote memory is real. On one node they add complexity without benefit.
Boring rule
Always print node*/cpulist and MemTotal before changing CPU affinity or memory policy. Install numactl only on machines you own when you need numactl --hardware pretty-printing.
Try this
- On a dual-socket host, compare
node0/distanceandnode1/distance. - Use
lscpuNUMA lines next to sysfs. - Read
numa(7).
Sources
numa(7), kernel Documentation/vm/numa*- sysfs
devices/system/node