Skip to content

Commit 7571d3d

Browse files
committed
cgroup: add cgroup v2 support
allow users to specify cgroup v2 resources. Each element in the map refers to a file in the cgroup v2 hierarchy and the element value has its content. Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent 8e2f17c commit 7571d3d

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

config-linux.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,31 @@ You MUST specify at least one of the `hcaHandles` or `hcaObjects` in a given ent
494494
}
495495
```
496496

497+
## <a name="configLinuxUnified" />Unified
498+
499+
**`unified`** (object, OPTIONAL) allows cgroup v2 parameters to be to be set and modified for the container.
500+
501+
Each key in the map refers to a file in the cgroup unified hierarchy.
502+
503+
The OCI runtime MUST ensure that the needed cgroup controllers are enabled for the cgroup.
504+
505+
Configuration unknown to the runtime MUST still be written to the relevant file.
506+
507+
The runtime MUST generate an error when the configuration refers to a cgroup controller that is not present or that cannot be enabled.
508+
509+
### Example
510+
511+
```json
512+
"unified": {
513+
"io.max": "259:0 rbps=2097152 wiops=120\n253:0 rbps=2097152 wiops=120",
514+
"hugetlb.1GB.max": "1073741824"
515+
}
516+
```
517+
518+
If a controller is enabled on the cgroup v2 hierarchy but the configuration is provided for the cgroup v1 equivalent controller, the runtime MAY attempt a conversion.
519+
520+
If the conversion is not possible the runtime MUST generate an error.
521+
497522
## <a name="configLinuxIntelRdt" />IntelRdt
498523

499524
**`intelRdt`** (object, OPTIONAL) represents the [Intel Resource Director Technology][intel-rdt-cat-kernel-interface].

schema/config-linux.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
"resources": {
3535
"type": "object",
3636
"properties": {
37+
"unified": {
38+
"$ref": "defs.json#/definitions/mapStringString"
39+
},
3740
"devices": {
3841
"type": "array",
3942
"items": {

specs-go/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ type LinuxResources struct {
372372
// Limits are a set of key value pairs that define RDMA resource limits,
373373
// where the key is device name and value is resource limits.
374374
Rdma map[string]LinuxRdma `json:"rdma,omitempty"`
375+
// Unified resources.
376+
Unified map[string]string `json:"unified,omitempty"`
375377
}
376378

377379
// LinuxDevice represents the mknod information for a Linux special device file

0 commit comments

Comments
 (0)