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

Linux 6.18.37 · Administration / Cgroup v1

RDMA Controller

RDMA resource pool, css ownership, device별 limit과 usage interface를 설명합니다.

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

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

1. 요약·해설

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

Overview and need

rdma.rst:1-36

RDMA resource exhaustion 문제와 controller의 제한 범위를 설명합니다.

Resource accounting

rdma.rst:37-91

Cgroup·device별 pool, css ownership, migration과 resource type을 정리합니다.

Usage examples

rdma.rst:92-117

`rdma.max`와 `rdma.current`의 설정·조회·삭제 예제를 보존합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ===============
2 RDMA Controller
3 ===============
4
5 .. Contents
6
7 1. Overview
8 1-1. What is RDMA controller?
9 1-2. Why RDMA controller needed?
10 1-3. How is RDMA controller implemented?
11 2. Usage Examples
12
13 1. Overview
14 ===========
15
16 1-1. What is RDMA controller?
17 -----------------------------
18
19 RDMA controller allows user to limit RDMA/IB specific resources that a given
20 set of processes can use. These processes are grouped using RDMA controller.
21
22 RDMA controller defines two resources which can be limited for processes of a
23 cgroup.
24
25 1-2. Why RDMA controller needed?
26 --------------------------------
27
28 Currently user space applications can easily take away all the rdma verb
29 specific resources such as AH, CQ, QP, MR etc. Due to which other applications
30 in other cgroup or kernel space ULPs may not even get chance to allocate any
31 rdma resources. This can lead to service unavailability.
32
33 Therefore RDMA controller is needed through which resource consumption
34 of processes can be limited. Through this controller different rdma
35 resources can be accounted.
36
37 1-3. How is RDMA controller implemented?
38 ----------------------------------------
39
40 RDMA cgroup allows limit configuration of resources. Rdma cgroup maintains
41 resource accounting per cgroup, per device using resource pool structure.
42 Each such resource pool is limited up to 64 resources in given resource pool
43 by rdma cgroup, which can be extended later if required.
44
45 This resource pool object is linked to the cgroup css. Typically there
46 are 0 to 4 resource pool instances per cgroup, per device in most use cases.
47 But nothing limits to have it more. At present hundreds of RDMA devices per
48 single cgroup may not be handled optimally, however there is no
49 known use case or requirement for such configuration either.
50
51 Since RDMA resources can be allocated from any process and can be freed by any
52 of the child processes which shares the address space, rdma resources are
53 always owned by the creator cgroup css. This allows process migration from one
54 to other cgroup without major complexity of transferring resource ownership;
55 because such ownership is not really present due to shared nature of
56 rdma resources. Linking resources around css also ensures that cgroups can be
57 deleted after processes migrated. This allow progress migration as well with
58 active resources, even though that is not a primary use case.
59
60 Whenever RDMA resource charging occurs, owner rdma cgroup is returned to
61 the caller. Same rdma cgroup should be passed while uncharging the resource.
62 This also allows process migrated with active RDMA resource to charge
63 to new owner cgroup for new resource. It also allows to uncharge resource of
64 a process from previously charged cgroup which is migrated to new cgroup,
65 even though that is not a primary use case.
66
67 Resource pool object is created in following situations.
68 (a) User sets the limit and no previous resource pool exist for the device
69 of interest for the cgroup.
70 (b) No resource limits were configured, but IB/RDMA stack tries to
71 charge the resource. So that it correctly uncharge them when applications are
72 running without limits and later on when limits are enforced during uncharging,
73 otherwise usage count will drop to negative.
74
75 Resource pool is destroyed if all the resource limits are set to max and
76 it is the last resource getting deallocated.
77
78 User should set all the limit to max value if it intents to remove/unconfigure
79 the resource pool for a particular device.
80
81 IB stack honors limits enforced by the rdma controller. When application
82 query about maximum resource limits of IB device, it returns minimum of
83 what is configured by user for a given cgroup and what is supported by
84 IB device.
85
86 Following resources can be accounted by rdma controller.
87
88 ========== =============================
89 hca_handle Maximum number of HCA Handles
90 hca_object Maximum number of HCA Objects
91 ========== =============================
92
93 2. Usage Examples
94 =================
95
96 (a) Configure resource limit::
97
98 echo mlx4_0 hca_handle=2 hca_object=2000 > /sys/fs/cgroup/rdma/1/rdma.max
99 echo ocrdma1 hca_handle=3 > /sys/fs/cgroup/rdma/2/rdma.max
100
101 (b) Query resource limit::
102
103 cat /sys/fs/cgroup/rdma/2/rdma.max
104 #Output:
105 mlx4_0 hca_handle=2 hca_object=2000
106 ocrdma1 hca_handle=3 hca_object=max
107
108 (c) Query current usage::
109
110 cat /sys/fs/cgroup/rdma/2/rdma.current
111 #Output:
112 mlx4_0 hca_handle=1 hca_object=20
113 ocrdma1 hca_handle=1 hca_object=23
114
115 (d) Delete resource limit::
116
117 echo mlx4_0 hca_handle=max hca_object=max > /sys/fs/cgroup/rdma/1/rdma.max
118

3. 한국어 전문 번역

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

RDMA controller의 범위

1-24

이 문서는 overview에서 RDMA controller의 정의, 필요성, 구현을 설명한 뒤 usage example을 제공합니다.

RDMA controller는 주어진 process 집합이 사용할 수 있는 RDMA/IB 전용 resource를 제한합니다. 이 process들은 RDMA controller를 이용해 group으로 묶입니다.

RDMA controller는 cgroup의 process에 대해 제한할 수 있는 resource 두 종류를 정의합니다.

RDMA resource 제한이 필요한 이유

25-36

현재 user-space application은 `AH`, `CQ`, `QP`, `MR` 같은 RDMA verb 전용 resource를 모두 쉽게 차지할 수 있습니다. 그러면 다른 cgroup의 application이나 kernel-space `ULP`가 RDMA resource를 할당받을 기회조차 잃어 service unavailable 상태가 될 수 있습니다.

따라서 process의 resource consumption을 제한하고 서로 다른 RDMA resource를 account하기 위해 RDMA controller가 필요합니다.

RDMA exhaustion prevention
User-space RDMA applicationConsumes AH/CQ/QP/MROther cgroups and kernel ULPs starveService unavailable
RDMA cgroup limitAccount per process group and devicePreserve resource availability

Controller가 없을 때 한 workload가 resource를 소진하는 문제를 cgroup limit으로 막습니다.

Resource pool과 css ownership

37-84

RDMA cgroup은 resource limit을 설정할 수 있게 하며, resource pool structure를 이용해 cgroup별·device별 accounting을 유지합니다. 각 resource pool은 현재 최대 64종의 resource를 담을 수 있고 필요하면 나중에 확장할 수 있습니다.

Resource pool object는 cgroup `css`에 연결됩니다. 일반적인 use case에서는 cgroup·device마다 pool instance가 0~4개이지만 더 많이 두는 것을 막는 제한은 없습니다. 다만 한 cgroup에 수백 개 RDMA device를 두는 구성은 현재 최적으로 처리되지 않을 수 있으며, 알려진 use case나 요구도 없습니다.

RDMA resource는 어느 process에서든 allocate될 수 있고 address space를 공유하는 child process 어느 쪽에서든 free될 수 있으므로 항상 creator cgroup `css`가 소유합니다. Shared resource 특성상 개별 process ownership을 실질적으로 이전하지 않아도 되어, process를 다른 cgroup으로 옮길 때 resource ownership transfer의 큰 복잡성을 피할 수 있습니다.

Resource를 `css`에 연결하면 process migration 뒤 cgroup을 삭제할 수 있고, 주된 use case는 아니지만 active resource를 가진 상태의 process migration도 진행할 수 있습니다.

RDMA resource를 charge할 때 caller에는 owner RDMA cgroup이 반환됩니다. Resource를 uncharge할 때 반드시 같은 RDMA cgroup을 전달해야 합니다. 따라서 active RDMA resource를 가진 process가 migrate한 뒤 새 resource는 새 owner cgroup에 charge하면서, 이전에 charge된 resource는 원래 cgroup에서 올바르게 uncharge할 수 있습니다.

Resource-pool lifecycle
EventPool behavior
User sets first device limit해당 cgroup·device에 기존 pool이 없으면 생성
IB/RDMA stack charges without configured limit나중의 uncharge가 usage를 음수로 만들지 않도록 생성
All limits are max and last resource is deallocatedPool 제거
Administrator wants to unconfigure a device pool모든 limit을 `max`로 설정

Pool을 만들고 유지하고 제거하는 조건입니다.

Limit이 아직 없더라도 IB/RDMA stack이 resource를 charge하면 pool을 만듭니다. 제한 없이 실행한 application의 resource를 나중에 limit 적용 중 uncharge할 때 usage count가 음수가 되지 않게 하기 위해서입니다.

모든 resource limit이 `max`이고 마지막 resource가 deallocate되면 pool을 파괴합니다. 특정 device의 resource pool 설정을 제거하려면 모든 limit을 `max`로 설정해야 합니다.

IB stack은 RDMA controller가 강제한 limit을 따릅니다. Application이 IB device의 maximum resource limit을 질의하면, 해당 cgroup에 사용자가 설정한 값과 IB device가 지원하는 값 가운데 더 작은 값을 반환합니다.

Charge ownership across migration
Process allocates resource in cgroup ACharge A and return owner AProcess migrates to cgroup BOld resource uncharges A
Process now in cgroup BNew allocation charges BReturn owner B for later uncharge

Active resource와 새 resource가 서로 다른 owner cgroup에 정확히 account되는 방식입니다.

Account 가능한 resource

85-91

RDMA controller는 다음 resource를 account할 수 있습니다.

RDMA resource types
ResourceLimit meaning
hca_handleHCA Handle의 maximum number
hca_objectHCA Object의 maximum number

원문의 resource 표를 구조화했습니다.

rdma.max와 rdma.current 사용 예제

92-117

Resource limit은 device 이름 뒤에 `resource=value` 쌍을 적어 `rdma.max`에 씁니다. 첫 명령은 `mlx4_0`의 `hca_handle`을 `2`, `hca_object`를 `2000`으로 제한하고, 둘째 명령은 `ocrdma1`의 `hca_handle`을 `3`으로 제한합니다.

	echo mlx4_0 hca_handle=2 hca_object=2000 > /sys/fs/cgroup/rdma/1/rdma.max
	echo ocrdma1 hca_handle=3 > /sys/fs/cgroup/rdma/2/rdma.max

`rdma.max`를 읽으면 device별 limit이 출력됩니다. 명시하지 않은 `ocrdma1 hca_object`는 `max`입니다.

	cat /sys/fs/cgroup/rdma/2/rdma.max
	#Output:
	mlx4_0 hca_handle=2 hca_object=2000
	ocrdma1 hca_handle=3 hca_object=max

`rdma.current`는 device별 현재 usage를 보여 줍니다. 예제에서는 `mlx4_0`이 handle `1`과 object `20`, `ocrdma1`이 handle `1`과 object `23`을 사용합니다.

	cat /sys/fs/cgroup/rdma/2/rdma.current
	#Output:
	mlx4_0 hca_handle=1 hca_object=20
	ocrdma1 hca_handle=1 hca_object=23

Resource limit을 삭제하려면 해당 device의 모든 값을 `max`로 설정합니다.

	echo mlx4_0 hca_handle=max hca_object=max > /sys/fs/cgroup/rdma/1/rdma.max