Skip to content

Commit 4bc6ff6

Browse files
committed
specs-go/config: add Intel RDT/MBA Linux support
Add support for Intel Resource Director Technology (RDT) / Memory Bandwidth Allocation (MBA). Add memory bandwidth resource constraints in Linux-specific configuration. This is the prerequisite of this runc proposal: opencontainers/runc#1596 For more information about Intel RDT/MBA, please refer to: opencontainers/runc#1596 Signed-off-by: Xiaochen Shen <[email protected]>
1 parent 4ebb31e commit 4bc6ff6

File tree

4 files changed

+59
-9
lines changed

4 files changed

+59
-9
lines changed

config-linux.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,19 +466,37 @@ The following parameters can be specified to set up the controller:
466466
The following parameters can be specified for the container:
467467

468468
* **`l3CacheSchema`** *(string, OPTIONAL)* - specifies the schema for L3 cache id and capacity bitmask (CBM).
469-
If `l3CacheSchema` is set, runtimes MUST write the value to the `schemata` file in the `<container-id>` directory discussed in `intelRdt`.
469+
* **`memBandwidth`** *(array of objects, OPTIONAL)* - an array of memory bandwidth (b/w) percentage per L3 cache id.
470+
Each entry has the following structure:
471+
* **`id`** *(uint32, REQUIRED)* - L3 cache id
472+
* **`value`** *(uint32, REQUIRED)* - memory bandwidth (b/w) percentage
473+
474+
If `l3CacheSchema` or `memBandwidth` is set, runtimes MUST write the value to the `schemata` file in the `<container-id>` directory discussed in `intelRdt`.
470475

471-
If `l3CacheSchema` is not set, runtimes MUST NOT write to `schemata` files in any `resctrl` pseudo-filesystems.
476+
If neither `l3CacheSchema` nor `memBandwidth` is set, runtimes MUST NOT write to `schemata` files in any `resctrl` pseudo-filesystems.
472477

473478
### Example
474479

475-
Consider a two-socket machine with two L3 caches where the default CBM is 0xfffff and the max CBM length is 20 bits.
476-
Tasks inside the container only have access to the "upper" 80% of L3 cache id 0 and the "lower" 50% L3 cache id 1:
480+
Consider a two-socket machine with two L3 caches where the default CBM is 0x7ff and the max CBM length is 11 bits,
481+
and minimum memory b/w of 10% with a memory b/w granularity of 10%.
482+
483+
Tasks inside the container only have access to the "upper" 7/11 of L3 cache on socket 0 and the "lower" 5/11 L3 cache on socket 1,
484+
and may use a maximum memory b/w of 20% on socket 0 and 70% on socket 1.
477485

478486
```json
479487
"linux": {
480488
"intelRdt": {
481-
"l3CacheSchema": "L3:0=ffff0;1=3ff"
489+
"l3CacheSchema": "L3:0=7f0;1=1f",
490+
"memBandwidth": [
491+
{
492+
"id": 0,
493+
"value": 20
494+
},
495+
{
496+
"id": 1,
497+
"value: 70
498+
},
499+
]
482500
}
483501
}
484502
```

schema/config-linux.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,13 @@
273273
"l3CacheSchema": {
274274
"id": "https://opencontainers.org/schema/bundle/linux/intelRdt/l3CacheSchema",
275275
"type": "string"
276+
},
277+
"memBandwidth": {
278+
"id": "https://opencontainers.org/schema/bundle/linux/intelRdt/memBandwidth",
279+
"type": "array",
280+
"items": {
281+
"$ref": "defs-linux.json#/definitions/IntelRdtMemBandwidth"
282+
}
276283
}
277284
}
278285
}

schema/defs-linux.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,21 @@
265265
"required": [
266266
"type"
267267
]
268+
},
269+
"IntelRdtMemBandwidth": {
270+
"type": "object",
271+
"properties": {
272+
"id": {
273+
"$ref": "defs.json#/definitions/uint32"
274+
},
275+
"value": {
276+
"$ref": "defs.json#/definitions/uint32"
277+
}
278+
},
279+
"required": [
280+
"id",
281+
"value"
282+
]
268283
}
269284
}
270285
}

specs-go/config.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ type Linux struct {
158158
ReadonlyPaths []string `json:"readonlyPaths,omitempty"`
159159
// MountLabel specifies the selinux context for the mounts in the container.
160160
MountLabel string `json:"mountLabel,omitempty"`
161-
// IntelRdt contains Intel Resource Director Technology (RDT) information
162-
// for handling resource constraints (e.g., L3 cache) for the container
161+
// IntelRdt contains Intel Resource Director Technology (RDT) information for
162+
// handling resource constraints (e.g., L3 cache, memory bandwidth) for the container
163163
IntelRdt *LinuxIntelRdt `json:"intelRdt,omitempty"`
164164
}
165165

@@ -561,10 +561,20 @@ type LinuxSyscall struct {
561561
Args []LinuxSeccompArg `json:"args,omitempty"`
562562
}
563563

564-
// LinuxIntelRdt has container runtime resource constraints
565-
// for Intel RDT/CAT which introduced in Linux 4.10 kernel
564+
// LinuxMemBandwidth specifies memory bandwidth (b/w) percentage per L3 cache id
565+
type LinuxMemBandwidth struct {
566+
id uint32 `json:"id"`
567+
value uint32 `json:"value"`
568+
}
569+
570+
// LinuxIntelRdt has container runtime resource constraints for Intel RDT
571+
// CAT and MBA features which introduced in Linux 4.10 and 4.12 kernel
566572
type LinuxIntelRdt struct {
567573
// The schema for L3 cache id and capacity bitmask (CBM)
568574
// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
569575
L3CacheSchema string `json:"l3CacheSchema,omitempty"`
576+
577+
// The schema of memory bandwidth (b/w) percentage per L3 cache id
578+
// Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."
579+
MemBandwidth []LinuxMemBandwidth `json:"memBandwidth,omitempty"`
570580
}

0 commit comments

Comments
 (0)