← Documents Documentation/admin-guide/cgroup-v1/net_prio.rst GitHub 원문 ↗

Linux 6.18.37 · Administration / Cgroup v1

Network priority cgroup

Process group별 interface egress priority, control file과 qdisc 적용 순서를 설명합니다.

Source pathDocumentation/admin-guide/cgroup-v1/net_prio.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

Purpose and mount

net_prio.rst:1-24

Application 대신 administrator가 egress priority를 정하는 model을 설명합니다.

Files and queueing

net_prio.rst:25-57

`prioidx`, `ifpriomap`, qdisc 적용 시점과 inheritance를 정리합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 =======================
2 Network priority cgroup
3 =======================
4
5 The Network priority cgroup provides an interface to allow an administrator to
6 dynamically set the priority of network traffic generated by various
7 applications
8
9 Nominally, an application would set the priority of its traffic via the
10 SO_PRIORITY socket option. This however, is not always possible because:
11
12 1) The application may not have been coded to set this value
13 2) The priority of application traffic is often a site-specific administrative
14 decision rather than an application defined one.
15
16 This cgroup allows an administrator to assign a process to a group which defines
17 the priority of egress traffic on a given interface. Network priority groups can
18 be created by first mounting the cgroup filesystem::
19
20 # mount -t cgroup -onet_prio none /sys/fs/cgroup/net_prio
21
22 With the above step, the initial group acting as the parent accounting group
23 becomes visible at '/sys/fs/cgroup/net_prio'. This group includes all tasks in
24 the system. '/sys/fs/cgroup/net_prio/tasks' lists the tasks in this cgroup.
25
26 Each net_prio cgroup contains two files that are subsystem specific
27
28 net_prio.prioidx
29 This file is read-only, and is simply informative. It contains a unique
30 integer value that the kernel uses as an internal representation of this
31 cgroup.
32
33 net_prio.ifpriomap
34 This file contains a map of the priorities assigned to traffic originating
35 from processes in this group and egressing the system on various interfaces.
36 It contains a list of tuples in the form <ifname priority>. Contents of this
37 file can be modified by echoing a string into the file using the same tuple
38 format. For example::
39
40 echo "eth0 5" > /sys/fs/cgroups/net_prio/iscsi/net_prio.ifpriomap
41
42 This command would force any traffic originating from processes belonging to the
43 iscsi net_prio cgroup and egressing on interface eth0 to have the priority of
44 said traffic set to the value 5. The parent accounting group also has a
45 writeable 'net_prio.ifpriomap' file that can be used to set a system default
46 priority.
47
48 Priorities are set immediately prior to queueing a frame to the device
49 queueing discipline (qdisc) so priorities will be assigned prior to the hardware
50 queue selection being made.
51
52 One usage for the net_prio cgroup is with mqprio qdisc allowing application
53 traffic to be steered to hardware/driver based traffic classes. These mappings
54 can then be managed by administrators or other networking protocols such as
55 DCBX.
56
57 A new net_prio cgroup inherits the parent's configuration.
58

3. 한국어 전문 번역

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

Network priority의 목적과 mount

1-24

Network priority cgroup은 여러 application이 생성하는 network traffic의 priority를 administrator가 동적으로 설정할 수 있게 하는 interface입니다.

일반적으로 application은 `SO_PRIORITY` socket option으로 자기 traffic priority를 정합니다. 하지만 application이 이 값을 설정하도록 작성되지 않았을 수 있고, traffic priority가 application 자체의 결정이 아니라 site별 administrative policy인 경우도 많으므로 항상 이 방식을 쓸 수 있는 것은 아닙니다.

이 cgroup은 process를 특정 group에 배치하고 interface별 egress traffic priority를 정의하게 합니다. Network priority group을 만들려면 먼저 cgroup filesystem을 다음과 같이 mount합니다.

	# mount -t cgroup -onet_prio none /sys/fs/cgroup/net_prio

이 단계가 끝나면 parent accounting group이 `/sys/fs/cgroup/net_prio`에 나타납니다. 이 group에는 system의 모든 task가 포함되며 `/sys/fs/cgroup/net_prio/tasks`가 그 task 목록을 보여 줍니다.

Network-priority policy
Application processAssigned to net_prio cgroupInterface-specific priority mapEgress frame priority

Application이 직접 priority를 지정할 수 없거나 site policy가 우선할 때 cgroup이 값을 제공합니다.

Subsystem-specific control files

25-46

각 `net_prio` cgroup에는 subsystem 전용 file 두 개가 있습니다.

net_prio control files
FileAccessMeaning
net_prio.prioidxRead-onlyKernel이 이 cgroup의 내부 표현으로 쓰는 고유 integer
net_prio.ifpriomapRead/writeGroup process의 interface별 egress priority map

두 file의 access mode와 의미입니다.

`net_prio.ifpriomap`은 이 group의 process에서 시작해 여러 interface로 나가는 traffic에 할당할 priority를 `<ifname priority>` tuple 목록으로 저장합니다. 같은 tuple 형식의 문자열을 file에 echo하여 내용을 수정할 수 있습니다.

	echo "eth0 5" > /sys/fs/cgroups/net_prio/iscsi/net_prio.ifpriomap

이 명령은 `iscsi` net_prio cgroup에 속한 process가 만들고 `eth0`으로 나가는 모든 traffic의 priority를 `5`로 강제합니다. Parent accounting group에도 writable `net_prio.ifpriomap`이 있으며 system default priority를 지정하는 데 사용할 수 있습니다.

Queue 선택, mqprio와 inheritance

47-57

Priority는 frame을 device queueing discipline(`qdisc`)에 넣기 직전에 설정됩니다. 따라서 hardware queue를 선택하기 전에 priority 할당이 완료됩니다.

`net_prio` cgroup은 `mqprio` qdisc와 함께 사용하여 application traffic을 hardware/driver 기반 traffic class로 보낼 수 있습니다. 이 mapping은 administrator나 `DCBX` 같은 다른 networking protocol이 관리할 수 있습니다.

새 `net_prio` cgroup은 parent의 configuration을 상속합니다.

Egress queue selection
Frame from cgroup processRead net_prio.ifpriomapAssign priorityEnter qdiscmqprio selects hardware/driver traffic class

Interface priority가 hardware queue 선택보다 먼저 적용되는 순서입니다.