← Documents Documentation/scheduler/sched-debug.rst GitHub 원문 ↗

Linux 6.18.37 · Scheduler

Scheduler debugfs와 NUMA balancing

scheduler debugfs 항목 가운데 automatic NUMA balancing의 scan 주기와 scan 크기 조정값을 설명합니다.

Source pathDocumentation/scheduler/sched-debug.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

debugfs 경로와 적용 범위

sched-debug.rst:1-8

scheduler debugfs 값은 부팅 ABI나 안정적인 사용자 API가 아니라 동작 관찰과 시험을 위한 조정점입니다. 커널 설정과 버전에 따라 항목이 달라질 수 있으므로 값을 바꾸기 전에 현재 커널의 파일 존재 여부와 단위를 확인해야 합니다.

numa_balancing 디렉터리

sched-debug.rst:9-55
항목의미영향
scan_period_min_ms초기 또는 최소 scan 간격작을수록 page hinting fault와 migration 반응이 빨라짐
scan_delay_mstask 시작 뒤 첫 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 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 =================
2 Scheduler debugfs
3 =================
4
5 Booting a kernel with debugfs enabled will give access to
6 scheduler specific debug files under /sys/kernel/debug/sched. Some of
7 those files are described below.
8
9 numa_balancing
10 ==============
11
12 `numa_balancing` directory is used to hold files to control NUMA
13 balancing feature. If the system overhead from the feature is too
14 high then the rate the kernel samples for NUMA hinting faults may be
15 controlled by the `scan_period_min_ms, scan_delay_ms,
16 scan_period_max_ms, scan_size_mb` files.
17
18
19 scan_period_min_ms, scan_delay_ms, scan_period_max_ms, scan_size_mb
20 -------------------------------------------------------------------
21
22 Automatic NUMA balancing scans tasks address space and unmaps pages to
23 detect if pages are properly placed or if the data should be migrated to a
24 memory node local to where the task is running. Every "scan delay" the task
25 scans the next "scan size" number of pages in its address space. When the
26 end of the address space is reached the scanner restarts from the beginning.
27
28 In combination, the "scan delay" and "scan size" determine the scan rate.
29 When "scan delay" decreases, the scan rate increases. The scan delay and
30 hence the scan rate of every task is adaptive and depends on historical
31 behaviour. If pages are properly placed then the scan delay increases,
32 otherwise the scan delay decreases. The "scan size" is not adaptive but
33 the higher the "scan size", the higher the scan rate.
34
35 Higher scan rates incur higher system overhead as page faults must be
36 trapped and potentially data must be migrated. However, the higher the scan
37 rate, the more quickly a tasks memory is migrated to a local node if the
38 workload pattern changes and minimises performance impact due to remote
39 memory accesses. These files control the thresholds for scan delays and
40 the number of pages scanned.
41
42 ``scan_period_min_ms`` is the minimum time in milliseconds to scan a
43 tasks virtual memory. It effectively controls the maximum scanning
44 rate for each task.
45
46 ``scan_delay_ms`` is the starting "scan delay" used for a task when it
47 initially forks.
48
49 ``scan_period_max_ms`` is the maximum time in milliseconds to scan a
50 tasks virtual memory. It effectively controls the minimum scanning
51 rate for each task.
52
53 ``scan_size_mb`` is how many megabytes worth of pages are scanned for
54 a given scan.
55

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Scheduler debugfs

1-17

debugfs를 활성화한 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-54

Automatic 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 단위로 지정한다.