요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
numa_balancing 디렉터리
sched-debug.rst:9-55| 항목 | 의미 | 영향 |
|---|---|---|
| scan_period_min_ms | 초기 또는 최소 scan 간격 | 작을수록 page hinting fault와 migration 반응이 빨라짐 |
| scan_delay_ms | task 시작 뒤 첫 scan까지 지연 | 초기화 구간의 불필요한 scan 억제 |
| scan_period_max_ms | 적응형 scan 간격의 상한 | 안정된 workload의 overhead 제한 |
| scan_size_mb | 한 번에 scan하는 가상 주소 공간 크기 | fault burst와 locality 탐지 속도 결정 |
automatic NUMA balancing은 PTE를 일시적으로 접근 불가 상태로 바꾸고 이후 발생하는 hinting fault를 이용해 실제 접근 CPU와 memory node 관계를 관찰합니다. scan을 공격적으로 하면 배치 수렴은 빨라지지만 page table 변경, TLB shootdown과 fault 처리 비용이 증가합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=================
Scheduler debugfs
=================
Booting a kernel with debugfs enabled will give access to
scheduler specific debug files under /sys/kernel/debug/sched. Some of
those files are described below.
numa_balancing
==============
`numa_balancing` directory is used to hold files to control NUMA
balancing feature. If the system overhead from the feature is too
high then the rate the kernel samples for NUMA hinting faults may be
controlled by the `scan_period_min_ms, scan_delay_ms,
scan_period_max_ms, scan_size_mb` files.
scan_period_min_ms, scan_delay_ms, scan_period_max_ms, scan_size_mb
-------------------------------------------------------------------
Automatic NUMA balancing scans tasks address space and unmaps pages to
detect if pages are properly placed or if the data should be migrated to a
memory node local to where the task is running. Every "scan delay" the task
scans the next "scan size" number of pages in its address space. When the
end of the address space is reached the scanner restarts from the beginning.
In combination, the "scan delay" and "scan size" determine the scan rate.
When "scan delay" decreases, the scan rate increases. The scan delay and
hence the scan rate of every task is adaptive and depends on historical
behaviour. If pages are properly placed then the scan delay increases,
otherwise the scan delay decreases. The "scan size" is not adaptive but
the higher the "scan size", the higher the scan rate.
Higher scan rates incur higher system overhead as page faults must be
trapped and potentially data must be migrated. However, the higher the scan
rate, the more quickly a tasks memory is migrated to a local node if the
workload pattern changes and minimises performance impact due to remote
memory accesses. These files control the thresholds for scan delays and
the number of pages scanned.
``scan_period_min_ms`` is the minimum time in milliseconds to scan a
tasks virtual memory. It effectively controls the maximum scanning
rate for each task.
``scan_delay_ms`` is the starting "scan delay" used for a task when it
initially forks.
``scan_period_max_ms`` is the maximum time in milliseconds to scan a
tasks virtual memory. It effectively controls the minimum scanning
rate for each task.
``scan_size_mb`` is how many megabytes worth of pages are scanned for
a given scan.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Scheduler debugfs
1-17debugfs를 활성화한 kernel을 boot하면 /sys/kernel/debug/sched 아래의 scheduler 전용 debug file에 접근할 수 있다. numa_balancing directory에는 NUMA balancing 기능을 제어하는 file이 들어 있다.
NUMA balancing의 system overhead가 지나치게 높다면 scan_period_min_ms, scan_delay_ms, scan_period_max_ms, scan_size_mb file을 이용해 kernel이 NUMA hinting fault를 sampling하는 비율을 조절할 수 있다.
NUMA balancing scan 주기와 크기
19-54Automatic NUMA balancing은 task의 address space를 scan하면서 page mapping을 해제한다. 이를 통해 page가 적절한 node에 배치되었는지, 또는 task가 실행되는 위치와 가까운 memory node로 data를 이동해야 하는지를 알아낸다.
Task는 scan delay마다 자신의 address space에서 다음 scan size만큼의 page를 scan한다. Address space 끝에 도달하면 처음부터 다시 시작한다. Scan delay와 scan size를 함께 적용한 값이 전체 scan rate를 결정한다.
Scan delay가 줄면 scan rate가 증가한다. 각 task의 scan delay와 scan rate는 과거 동작에 따라 적응적으로 변한다. Page가 올바르게 배치되어 있으면 scan delay가 늘고, 그렇지 않으면 줄어든다. Scan size는 적응적으로 변하지 않으며 값이 클수록 scan rate가 높아진다.
Scan rate가 높으면 page fault를 trap하고 data를 이동해야 하므로 system overhead가 커진다. 반면 workload pattern이 바뀌었을 때 task의 memory를 local node로 더 빨리 이동시켜 remote memory 접근의 성능 손실을 줄일 수 있다.
- scan_period_min_ms는 task virtual memory를 한 차례 scan하는 최소 millisecond 시간이며 task별 최대 scan rate를 실질적으로 제한한다.
- scan_delay_ms는 task가 처음 fork될 때 사용하는 초기 scan delay다.
- scan_period_max_ms는 task virtual memory를 한 차례 scan하는 최대 millisecond 시간이며 task별 최소 scan rate를 실질적으로 제한한다.
- scan_size_mb는 한 번의 scan에서 확인할 page 양을 megabyte 단위로 지정한다.
debugfs 경로와 적용 범위
sched-debug.rst:1-8scheduler debugfs 값은 부팅 ABI나 안정적인 사용자 API가 아니라 동작 관찰과 시험을 위한 조정점입니다. 커널 설정과 버전에 따라 항목이 달라질 수 있으므로 값을 바꾸기 전에 현재 커널의 파일 존재 여부와 단위를 확인해야 합니다.