xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/numastat.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===============================
2*4882a593SmuzhiyunNuma policy hit/miss statistics
3*4882a593Smuzhiyun===============================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun/sys/devices/system/node/node*/numastat
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunAll units are pages. Hugepages have separate counters.
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunThe numa_hit, numa_miss and numa_foreign counters reflect how well processes
10*4882a593Smuzhiyunare able to allocate memory from nodes they prefer. If they succeed, numa_hit
11*4882a593Smuzhiyunis incremented on the preferred node, otherwise numa_foreign is incremented on
12*4882a593Smuzhiyunthe preferred node and numa_miss on the node where allocation succeeded.
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunUsually preferred node is the one local to the CPU where the process executes,
15*4882a593Smuzhiyunbut restrictions such as mempolicies can change that, so there are also two
16*4882a593Smuzhiyuncounters based on CPU local node. local_node is similar to numa_hit and is
17*4882a593Smuzhiyunincremented on allocation from a node by CPU on the same node. other_node is
18*4882a593Smuzhiyunsimilar to numa_miss and is incremented on the node where allocation succeeds
19*4882a593Smuzhiyunfrom a CPU from a different node. Note there is no counter analogical to
20*4882a593Smuzhiyunnuma_foreign.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunIn more detail:
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun=============== ============================================================
25*4882a593Smuzhiyunnuma_hit	A process wanted to allocate memory from this node,
26*4882a593Smuzhiyun		and succeeded.
27*4882a593Smuzhiyun
28*4882a593Smuzhiyunnuma_miss	A process wanted to allocate memory from another node,
29*4882a593Smuzhiyun		but ended up with memory from this node.
30*4882a593Smuzhiyun
31*4882a593Smuzhiyunnuma_foreign	A process wanted to allocate on this node,
32*4882a593Smuzhiyun		but ended up with memory from another node.
33*4882a593Smuzhiyun
34*4882a593Smuzhiyunlocal_node	A process ran on this node's CPU,
35*4882a593Smuzhiyun		and got memory from this node.
36*4882a593Smuzhiyun
37*4882a593Smuzhiyunother_node	A process ran on a different node's CPU
38*4882a593Smuzhiyun		and got memory from this node.
39*4882a593Smuzhiyun
40*4882a593Smuzhiyuninterleave_hit 	Interleaving wanted to allocate from this node
41*4882a593Smuzhiyun		and succeeded.
42*4882a593Smuzhiyun=============== ============================================================
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunFor easier reading you can use the numastat utility from the numactl package
45*4882a593Smuzhiyun(http://oss.sgi.com/projects/libnuma/). Note that it only works
46*4882a593Smuzhiyunwell right now on machines with a small number of CPUs.
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunNote that on systems with memoryless nodes (where a node has CPUs but no
49*4882a593Smuzhiyunmemory) the numa_hit, numa_miss and numa_foreign statistics can be skewed
50*4882a593Smuzhiyunheavily. In the current kernel implementation, if a process prefers a
51*4882a593Smuzhiyunmemoryless node (i.e.  because it is running on one of its local CPU), the
52*4882a593Smuzhiyunimplementation actually treats one of the nearest nodes with memory as the
53*4882a593Smuzhiyunpreferred node. As a result, such allocation will not increase the numa_foreign
54*4882a593Smuzhiyuncounter on the memoryless node, and will skew the numa_hit, numa_miss and
55*4882a593Smuzhiyunnuma_foreign statistics of the nearest node.
56