← Documents Documentation/accounting/cgroupstats.rst GitHub 원문 ↗

Linux 6.18.37 · Accounting

Control Groupstats

Taskstats를 재사용해 cgroup path별 task state count를 반환하는 pull interface와 getdelays 예제를 설명합니다.

Source pathDocumentation/accounting/cgroupstats.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

통계 model

cgroupstats.rst:1-22

Cgroup별 task state를 pull 방식으로 집계하며 I/O blocked 정보에는 delay accounting이 필요합니다.

조회 예제

cgroupstats.rst:23-31

getdelays형 utility의 -C path 조회 결과를 보존합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 ==================
2 Control Groupstats
3 ==================
4
5 Control Groupstats is inspired by the discussion at
6 https://lore.kernel.org/r/[email protected] and implements per cgroup statistics as
7 suggested by Andrew Morton in https://lore.kernel.org/r/[email protected].
8
9 Per cgroup statistics infrastructure re-uses code from the taskstats
10 interface. A new set of cgroup operations are registered with commands
11 and attributes specific to cgroups. It should be very easy to
12 extend per cgroup statistics, by adding members to the cgroupstats
13 structure.
14
15 The current model for cgroupstats is a pull, a push model (to post
16 statistics on interesting events), should be very easy to add. Currently
17 user space requests for statistics by passing the cgroup path.
18 Statistics about the state of all the tasks in the cgroup is returned to
19 user space.
20
21 NOTE: We currently rely on delay accounting for extracting information
22 about tasks blocked on I/O. If CONFIG_TASK_DELAY_ACCT is disabled, this
23 information will not be available.
24
25 To extract cgroup statistics a utility very similar to getdelays.c
26 has been developed, the sample output of the utility is shown below::
27
28 ~/balbir/cgroupstats # ./getdelays -C "/sys/fs/cgroup/a"
29 sleeping 1, blocked 0, running 1, stopped 0, uninterruptible 0
30 ~/balbir/cgroupstats # ./getdelays -C "/sys/fs/cgroup"
31 sleeping 155, blocked 0, running 1, stopped 0, uninterruptible 2
32

3. 한국어 전문 번역

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

Per-cgroup task state statistics

1-22

Control Groupstats는 `https://lore.kernel.org/r/[email protected]` 논의에서 영감을 받았고 Andrew Morton이 `https://lore.kernel.org/r/[email protected]`에서 제안한 per-cgroup statistic을 구현합니다.

Per-cgroup statistics infrastructure는 taskstats interface code를 재사용합니다. Cgroup 전용 command와 attribute를 가진 새 cgroup operation set을 register합니다. `cgroupstats` structure에 member를 추가하면 쉽게 확장할 수 있습니다.

현재 model은 pull 방식이지만 관심 event 때 statistic을 post하는 push model도 쉽게 추가할 수 있습니다. Userspace는 cgroup path를 전달해 statistic을 요청하고 kernel은 cgroup 내 모든 task의 state statistic을 반환합니다.

I/O에서 blocked된 task 정보는 delay accounting에 의존합니다. `CONFIG_TASK_DELAY_ACCT`가 disable이면 이 정보는 제공되지 않습니다.

cgroupstats pull model
Userspace passes cgroup pathCgroup-specific taskstats commandInspect all tasks in cgroupReturn state counts
CONFIG_TASK_DELAY_ACCT disabledBlocked-on-I/O information unavailable

Taskstats 기반 cgroup operation이 path 요청을 task-state counts로 변환합니다.

getdelays cgroupstats 예제

23-31

Cgroup statistic 추출용으로 `getdelays.c`와 매우 비슷한 utility가 개발됐습니다. `-C`에 cgroup path를 주면 sleeping, blocked, running, stopped, uninterruptible task count를 출력합니다.

has been developed, the sample output of the utility is shown below::

  ~/balbir/cgroupstats # ./getdelays  -C "/sys/fs/cgroup/a"
  sleeping 1, blocked 0, running 1, stopped 0, uninterruptible 0
  ~/balbir/cgroupstats # ./getdelays  -C "/sys/fs/cgroup"
  sleeping 155, blocked 0, running 1, stopped 0, uninterruptible 2
cgroup task-state counters
CounterMeaning
sleepingSleeping tasks
blockedTasks blocked on I/O
runningRunnable/running tasks
stoppedStopped tasks
uninterruptibleUninterruptible sleep tasks

Utility가 한 줄에 반환하는 다섯 state입니다.