요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
Files and queueing
net_prio.rst:25-57`prioidx`, `ifpriomap`, qdisc 적용 시점과 inheritance를 정리합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=======================
Network priority cgroup
=======================
The Network priority cgroup provides an interface to allow an administrator to
dynamically set the priority of network traffic generated by various
applications
Nominally, an application would set the priority of its traffic via the
SO_PRIORITY socket option. This however, is not always possible because:
1) The application may not have been coded to set this value
2) The priority of application traffic is often a site-specific administrative
decision rather than an application defined one.
This cgroup allows an administrator to assign a process to a group which defines
the priority of egress traffic on a given interface. Network priority groups can
be created by first mounting the cgroup filesystem::
# mount -t cgroup -onet_prio none /sys/fs/cgroup/net_prio
With the above step, the initial group acting as the parent accounting group
becomes visible at '/sys/fs/cgroup/net_prio'. This group includes all tasks in
the system. '/sys/fs/cgroup/net_prio/tasks' lists the tasks in this cgroup.
Each net_prio cgroup contains two files that are subsystem specific
net_prio.prioidx
This file is read-only, and is simply informative. It contains a unique
integer value that the kernel uses as an internal representation of this
cgroup.
net_prio.ifpriomap
This file contains a map of the priorities assigned to traffic originating
from processes in this group and egressing the system on various interfaces.
It contains a list of tuples in the form <ifname priority>. Contents of this
file can be modified by echoing a string into the file using the same tuple
format. For example::
echo "eth0 5" > /sys/fs/cgroups/net_prio/iscsi/net_prio.ifpriomap
This command would force any traffic originating from processes belonging to the
iscsi net_prio cgroup and egressing on interface eth0 to have the priority of
said traffic set to the value 5. The parent accounting group also has a
writeable 'net_prio.ifpriomap' file that can be used to set a system default
priority.
Priorities are set immediately prior to queueing a frame to the device
queueing discipline (qdisc) so priorities will be assigned prior to the hardware
queue selection being made.
One usage for the net_prio cgroup is with mqprio qdisc allowing application
traffic to be steered to hardware/driver based traffic classes. These mappings
can then be managed by administrators or other networking protocols such as
DCBX.
A new net_prio cgroup inherits the parent's configuration.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Network priority의 목적과 mount
1-24Network 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 목록을 보여 줍니다.
Application이 직접 priority를 지정할 수 없거나 site policy가 우선할 때 cgroup이 값을 제공합니다.
Subsystem-specific control files
25-46각 `net_prio` cgroup에는 subsystem 전용 file 두 개가 있습니다.
두 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-57Priority는 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을 상속합니다.
Interface priority가 hardware queue 선택보다 먼저 적용되는 순서입니다.
Purpose and mount
net_prio.rst:1-24Application 대신 administrator가 egress priority를 정하는 model을 설명합니다.