Skip to content

Commit 90355f0

Browse files
committed
libcontainer: intelrdt: add Intel RDT/MBA docs in SPEC.md
Signed-off-by: Xiaochen Shen <[email protected]>
1 parent 129732d commit 90355f0

File tree

1 file changed

+68
-36
lines changed

1 file changed

+68
-36
lines changed

libcontainer/SPEC.md

Lines changed: 68 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,21 @@ init process will block waiting for the parent to finish setup.
156156

157157
### IntelRdt
158158

159-
Intel platforms with new Xeon CPU support Intel Resource Director Technology
160-
(RDT). Cache Allocation Technology (CAT) is a sub-feature of RDT, which
161-
currently supports L3 cache resource allocation.
159+
Intel platforms with new Xeon CPU support Resource Director Technology (RDT).
160+
Cache Allocation Technology (CAT) and Memory Bandwidth Allocation (MBA) are
161+
two sub-features of RDT.
162162

163-
This feature provides a way for the software to restrict cache allocation to a
164-
defined 'subset' of L3 cache which may be overlapping with other 'subsets'.
165-
The different subsets are identified by class of service (CLOS) and each CLOS
166-
has a capacity bitmask (CBM).
163+
Cache Allocation Technology (CAT) provides a way for the software to restrict
164+
cache allocation to a defined 'subset' of L3 cache which may be overlapping
165+
with other 'subsets'. The different subsets are identified by class of
166+
service (CLOS) and each CLOS has a capacity bitmask (CBM).
167167

168-
It can be used to handle L3 cache resource allocation for containers if
169-
hardware and kernel support Intel RDT/CAT.
168+
Memory Bandwidth Allocation (MBA) provides indirect and approximate throttle
169+
over memory bandwidth for the software. A user controls the resource by
170+
indicating the percentage of maximum memory bandwidth.
171+
172+
It can be used to handle L3 cache and memory bandwidth resources allocation
173+
for containers if hardware and kernel support Intel RDT CAT and MBA features.
170174

171175
In Linux 4.10 kernel or newer, the interface is defined and exposed via
172176
"resource control" filesystem, which is a "cgroup-like" interface.
@@ -175,66 +179,94 @@ Comparing with cgroups, it has similar process management lifecycle and
175179
interfaces in a container. But unlike cgroups' hierarchy, it has single level
176180
filesystem layout.
177181

182+
CAT and MBA features are introduced in Linux 4.10 and 4.12 kernel via
183+
"resource control" filesystem.
184+
178185
Intel RDT "resource control" filesystem hierarchy:
179186
```
180187
mount -t resctrl resctrl /sys/fs/resctrl
181188
tree /sys/fs/resctrl
182189
/sys/fs/resctrl/
183190
|-- info
184191
| |-- L3
185-
| |-- cbm_mask
186-
| |-- min_cbm_bits
192+
| | |-- cbm_mask
193+
| | |-- min_cbm_bits
194+
| | |-- num_closids
195+
| |-- MB
196+
| |-- bandwidth_gran
197+
| |-- delay_linear
198+
| |-- min_bandwidth
187199
| |-- num_closids
188-
|-- cpus
200+
|-- ...
189201
|-- schemata
190202
|-- tasks
191203
|-- <container_id>
192-
|-- cpus
204+
|-- ...
193205
|-- schemata
194206
|-- tasks
195-
196207
```
197208

198-
For runc, we can make use of `tasks` and `schemata` configuration for L3 cache
199-
resource constraints.
209+
For runc, we can make use of `tasks` and `schemata` configuration for L3
210+
cache and memory bandwidth resources constraints.
200211

201212
The file `tasks` has a list of tasks that belongs to this group (e.g.,
202213
<container_id>" group). Tasks can be added to a group by writing the task ID
203-
to the "tasks" file (which will automatically remove them from the previous
214+
to the "tasks" file (which will automatically remove them from the previous
204215
group to which they belonged). New tasks created by fork(2) and clone(2) are
205-
added to the same group as their parent. If a pid is not in any sub group, it
206-
is in root group.
216+
added to the same group as their parent.
207217

208-
The file `schemata` has allocation masks/values for L3 cache on each socket,
209-
which contains L3 cache id and capacity bitmask (CBM).
218+
The file `schemata` has a list of all the resources available to this group.
219+
Each resource (L3 cache, memory bandwidth) has its own line and format.
220+
221+
L3 cache schema:
222+
It has allocation bitmasks/values for L3 cache on each socket, which
223+
contains L3 cache id and capacity bitmask (CBM).
210224
```
211225
Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
212226
```
213-
For example, on a two-socket machine, L3's schema line could be `L3:0=ff;1=c0`
214-
Which means L3 cache id 0's CBM is 0xff, and L3 cache id 1's CBM is 0xc0.
227+
For example, on a two-socket machine, the schema line could be "L3:0=ff;1=c0"
228+
which means L3 cache id 0's CBM is 0xff, and L3 cache id 1's CBM is 0xc0.
215229

216230
The valid L3 cache CBM is a *contiguous bits set* and number of bits that can
217231
be set is less than the max bit. The max bits in the CBM is varied among
218-
supported Intel Xeon platforms. In Intel RDT "resource control" filesystem
219-
layout, the CBM in a group should be a subset of the CBM in root. Kernel will
220-
check if it is valid when writing. e.g., 0xfffff in root indicates the max bits
221-
of CBM is 20 bits, which mapping to entire L3 cache capacity. Some valid CBM
222-
values to set in a group: 0xf, 0xf0, 0x3ff, 0x1f00 and etc.
232+
supported Intel CPU models. Kernel will check if it is valid when writing.
233+
e.g., default value 0xfffff in root indicates the max bits of CBM is 20
234+
bits, which mapping to entire L3 cache capacity. Some valid CBM values to
235+
set in a group: 0xf, 0xf0, 0x3ff, 0x1f00 and etc.
236+
237+
Memory bandwidth schema:
238+
It has allocation values for memory bandwidth on each socket, which contains
239+
L3 cache id and memory bandwidth percentage.
240+
```
241+
Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."
242+
```
243+
For example, on a two-socket machine, the schema line could be "MB:0=20;1=70"
244+
245+
The minimum bandwidth percentage value for each CPU model is predefined and
246+
can be looked up through "info/MB/min_bandwidth". The bandwidth granularity
247+
that is allocated is also dependent on the CPU model and can be looked up at
248+
"info/MB/bandwidth_gran". The available bandwidth control steps are:
249+
min_bw + N * bw_gran. Intermediate values are rounded to the next control
250+
step available on the hardware.
223251

224-
For more information about Intel RDT/CAT kernel interface:
252+
For more information about Intel RDT kernel interface:
225253
https://www.kernel.org/doc/Documentation/x86/intel_rdt_ui.txt
226254

227-
An example for runc:
228255
```
256+
An example for runc:
229257
Consider a two-socket machine with two L3 caches where the default CBM is
230-
0xfffff and the max CBM length is 20 bits. With this configuration, tasks
231-
inside the container only have access to the "upper" 80% of L3 cache id 0 and
232-
the "lower" 50% L3 cache id 1:
258+
0x7ff and the max CBM length is 11 bits, and minimum memory bandwidth of 10%
259+
with a memory bandwidth granularity of 10%.
260+
261+
Tasks inside the container only have access to the "upper" 7/11 of L3 cache
262+
on socket 0 and the "lower" 5/11 L3 cache on socket 1, and may use a
263+
maximum memory bandwidth of 20% on socket 0 and 70% on socket 1.
233264
234265
"linux": {
235-
"intelRdt": {
236-
"l3CacheSchema": "L3:0=ffff0;1=3ff"
237-
}
266+
"intelRdt": {
267+
"l3CacheSchema": "L3:0=7f0;1=1f",
268+
"memBwSchema": "MB:0=20;1=70"
269+
}
238270
}
239271
```
240272

0 commit comments

Comments
 (0)