xref: /linux/Documentation/admin-guide/numastat.rst (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
14f4cfa6cSMauro Carvalho Chehab===============================
24f4cfa6cSMauro Carvalho ChehabNuma policy hit/miss statistics
34f4cfa6cSMauro Carvalho Chehab===============================
44f4cfa6cSMauro Carvalho Chehab
54f4cfa6cSMauro Carvalho Chehab/sys/devices/system/node/node*/numastat
64f4cfa6cSMauro Carvalho Chehab
74f4cfa6cSMauro Carvalho ChehabAll units are pages. Hugepages have separate counters.
84f4cfa6cSMauro Carvalho Chehab
9*77691ee9SVlastimil BabkaThe numa_hit, numa_miss and numa_foreign counters reflect how well processes
10*77691ee9SVlastimil Babkaare able to allocate memory from nodes they prefer. If they succeed, numa_hit
11*77691ee9SVlastimil Babkais incremented on the preferred node, otherwise numa_foreign is incremented on
12*77691ee9SVlastimil Babkathe preferred node and numa_miss on the node where allocation succeeded.
13*77691ee9SVlastimil Babka
14*77691ee9SVlastimil BabkaUsually preferred node is the one local to the CPU where the process executes,
15*77691ee9SVlastimil Babkabut restrictions such as mempolicies can change that, so there are also two
16*77691ee9SVlastimil Babkacounters based on CPU local node. local_node is similar to numa_hit and is
17*77691ee9SVlastimil Babkaincremented on allocation from a node by CPU on the same node. other_node is
18*77691ee9SVlastimil Babkasimilar to numa_miss and is incremented on the node where allocation succeeds
19*77691ee9SVlastimil Babkafrom a CPU from a different node. Note there is no counter analogical to
20*77691ee9SVlastimil Babkanuma_foreign.
21*77691ee9SVlastimil Babka
22*77691ee9SVlastimil BabkaIn more detail:
23*77691ee9SVlastimil Babka
244f4cfa6cSMauro Carvalho Chehab=============== ============================================================
254f4cfa6cSMauro Carvalho Chehabnuma_hit	A process wanted to allocate memory from this node,
264f4cfa6cSMauro Carvalho Chehab		and succeeded.
274f4cfa6cSMauro Carvalho Chehab
284f4cfa6cSMauro Carvalho Chehabnuma_miss	A process wanted to allocate memory from another node,
294f4cfa6cSMauro Carvalho Chehab		but ended up with memory from this node.
304f4cfa6cSMauro Carvalho Chehab
314f4cfa6cSMauro Carvalho Chehabnuma_foreign	A process wanted to allocate on this node,
32*77691ee9SVlastimil Babka		but ended up with memory from another node.
334f4cfa6cSMauro Carvalho Chehab
34*77691ee9SVlastimil Babkalocal_node	A process ran on this node's CPU,
35*77691ee9SVlastimil Babka		and got memory from this node.
364f4cfa6cSMauro Carvalho Chehab
37*77691ee9SVlastimil Babkaother_node	A process ran on a different node's CPU
38*77691ee9SVlastimil Babka		and got memory from this node.
394f4cfa6cSMauro Carvalho Chehab
404f4cfa6cSMauro Carvalho Chehabinterleave_hit 	Interleaving wanted to allocate from this node
414f4cfa6cSMauro Carvalho Chehab		and succeeded.
424f4cfa6cSMauro Carvalho Chehab=============== ============================================================
434f4cfa6cSMauro Carvalho Chehab
444f4cfa6cSMauro Carvalho ChehabFor easier reading you can use the numastat utility from the numactl package
454f4cfa6cSMauro Carvalho Chehab(http://oss.sgi.com/projects/libnuma/). Note that it only works
464f4cfa6cSMauro Carvalho Chehabwell right now on machines with a small number of CPUs.
474f4cfa6cSMauro Carvalho Chehab
48*77691ee9SVlastimil BabkaNote that on systems with memoryless nodes (where a node has CPUs but no
49*77691ee9SVlastimil Babkamemory) the numa_hit, numa_miss and numa_foreign statistics can be skewed
50*77691ee9SVlastimil Babkaheavily. In the current kernel implementation, if a process prefers a
51*77691ee9SVlastimil Babkamemoryless node (i.e.  because it is running on one of its local CPU), the
52*77691ee9SVlastimil Babkaimplementation actually treats one of the nearest nodes with memory as the
53*77691ee9SVlastimil Babkapreferred node. As a result, such allocation will not increase the numa_foreign
54*77691ee9SVlastimil Babkacounter on the memoryless node, and will skew the numa_hit, numa_miss and
55*77691ee9SVlastimil Babkanuma_foreign statistics of the nearest node.
56