요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
===============================
Numa policy hit/miss statistics
===============================
/sys/devices/system/node/node*/numastat
All units are pages. Hugepages have separate counters.
The numa_hit, numa_miss and numa_foreign counters reflect how well processes
are able to allocate memory from nodes they prefer. If they succeed, numa_hit
is incremented on the preferred node, otherwise numa_foreign is incremented on
the preferred node and numa_miss on the node where allocation succeeded.
Usually preferred node is the one local to the CPU where the process executes,
but restrictions such as mempolicies can change that, so there are also two
counters based on CPU local node. local_node is similar to numa_hit and is
incremented on allocation from a node by CPU on the same node. other_node is
similar to numa_miss and is incremented on the node where allocation succeeds
from a CPU from a different node. Note there is no counter analogical to
numa_foreign.
In more detail:
=============== ============================================================
numa_hit A process wanted to allocate memory from this node,
and succeeded.
numa_miss A process wanted to allocate memory from another node,
but ended up with memory from this node.
numa_foreign A process wanted to allocate on this node,
but ended up with memory from another node.
local_node A process ran on this node's CPU,
and got memory from this node.
other_node A process ran on a different node's CPU
and got memory from this node.
interleave_hit Interleaving wanted to allocate from this node
and succeeded.
=============== ============================================================
For easier reading you can use the numastat utility from the numactl package
(http://oss.sgi.com/projects/libnuma/). Note that it only works
well right now on machines with a small number of CPUs.
Note that on systems with memoryless nodes (where a node has CPUs but no
memory) the numa_hit, numa_miss and numa_foreign statistics can be skewed
heavily. In the current kernel implementation, if a process prefers a
memoryless node (i.e. because it is running on one of its local CPU), the
implementation actually treats one of the nearest nodes with memory as the
preferred node. As a result, such allocation will not increase the numa_foreign
counter on the memoryless node, and will skew the numa_hit, numa_miss and
numa_foreign statistics of the nearest node.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Interface와 단위
1-7`Numa policy hit/miss statistics`는 `/sys/devices/system/node/node*/numastat`에 노출됩니다. 모든 단위는 page이며 hugepage는 별도 counter를 가집니다.
정책 선호도와 CPU locality
8-20`numa_hit`, `numa_miss`, `numa_foreign`은 process가 선호 node에서 memory를 할당하는 데 얼마나 성공하는지 보여 줍니다. 성공하면 preferred node의 `numa_hit`가 증가합니다. 실패하면 preferred node의 `numa_foreign`과 실제 성공 node의 `numa_miss`가 증가합니다.
Preferred node는 보통 process가 실행되는 CPU의 local node지만 mempolicies 같은 제한이 이를 바꿀 수 있습니다. 그래서 CPU local node 기준 counter도 있습니다.
`local_node`는 같은 node의 CPU가 그 node에서 할당할 때 증가하고, `other_node`는 다른 node CPU의 요청이 이 node에서 성공할 때 증가합니다. `numa_foreign`에 대응하는 CPU-local counter는 없습니다.
Counter 정의
21-42| Counter | 증가 조건 |
|---|---|
| `numa_hit` | 이 node에서 할당하려 했고 이 node에서 성공 |
| `numa_miss` | 다른 node를 원했지만 이 node에서 할당 성공 |
| `numa_foreign` | 이 node를 원했지만 다른 node에서 할당 성공 |
| `local_node` | 이 node의 CPU에서 실행하고 이 node의 memory를 받음 |
| `other_node` | 다른 node의 CPU에서 실행하고 이 node의 memory를 받음 |
| `interleave_hit` | Interleaving이 이 node를 선택했고 할당 성공 |
numastat utility
43-46읽기 쉽게 하려면 numactl package의 `numastat` utility를 사용할 수 있습니다. 원문은 현재 CPU 수가 적은 machine에서만 잘 동작한다고 주의합니다.
Memoryless node의 통계 왜곡
47-55CPU는 있지만 memory가 없는 memoryless node에서는 `numa_hit`, `numa_miss`, `numa_foreign` 통계가 크게 왜곡될 수 있습니다.
Process가 local CPU에서 실행되어 memoryless node를 선호해도 현재 kernel은 실제로 가장 가까운 memory 보유 node 하나를 preferred node로 취급합니다. 따라서 해당 할당은 memoryless node의 `numa_foreign`을 늘리지 않고, 가까운 node의 세 NUMA 통계를 왜곡합니다.
운영 핵심
numastat.rst:1-55Policy 관점 counter와 CPU locality 관점 counter를 함께 읽어야 하며 memoryless node에서는 통계 해석에 주의해야 합니다.