Skip to content

Commit 8e0dce8

Browse files
authored
Merge pull request opencontainers#1191 from utam0k/io-prio
Add I/O Priority Configuration for process group in Linux Containers
2 parents 7529d10 + 504f70e commit 8e0dce8

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

config.md

+14
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,12 @@ For Linux-based systems, the `process` object supports the following process-spe
320320
* **`period`** (uint64, OPTIONAL) represents the length of the period in nanoseconds used for determining the process runtime, used by the deadline scheduler. If not set, the runtime must use the value 0.
321321
* **`selinuxLabel`** (string, OPTIONAL) specifies the SELinux label for the process.
322322
For more information about SELinux, see [SELinux documentation][selinux].
323+
* **`ioPriority`** (object, OPTIONAL) configures the I/O priority settings for the container's processes within the process group.
324+
The I/O priority settings will be automatically applied to the entire process group, affecting all processes within the container.
325+
The following properties are available:
326+
327+
* **`class`** (string, REQUIRED) specifies the I/O scheduling class. Possible values are `IOPRIO_CLASS_RT`, `IOPRIO_CLASS_BE`, and `IOPRIO_CLASS_IDLE`.
328+
* **`priority`** (int, REQUIRED) specifies the priority level within the class. The value should be an integer ranging from 0 (highest) to 7 (lowest).
323329

324330
### <a name="configUser" />User
325331

@@ -361,6 +367,10 @@ _Note: symbolic name for uid and gid, such as uname and gname respectively, are
361367
],
362368
"apparmorProfile": "acme_secure_profile",
363369
"selinuxLabel": "system_u:system_r:svirt_lxc_net_t:s0:c124,c675",
370+
"ioPriority": {
371+
"class": "IOPRIO_CLASS_IDLE",
372+
"priority": 4
373+
},
364374
"noNewPrivileges": true,
365375
"capabilities": {
366376
"bounding": [
@@ -761,6 +771,10 @@ Here is a full example `config.json` for reference.
761771
"apparmorProfile": "acme_secure_profile",
762772
"oomScoreAdj": 100,
763773
"selinuxLabel": "system_u:system_r:svirt_lxc_net_t:s0:c124,c675",
774+
"ioPriority": {
775+
"class": "IOPRIO_CLASS_IDLE",
776+
"priority": 4
777+
},
764778
"noNewPrivileges": true
765779
},
766780
"root": {

schema/config-schema.json

+9
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@
144144
"selinuxLabel": {
145145
"type": "string"
146146
},
147+
"ioPriority": {
148+
"class": "string",
149+
"enum": [
150+
"IOPRIO_CLASS_RT",
151+
"IOPRIO_CLASS_BE",
152+
"IOPRIO_CLASS_IDLE"
153+
],
154+
"priority": "integer"
155+
},
147156
"noNewPrivileges": {
148157
"type": "boolean"
149158
},

specs-go/config.go

+18
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ type Process struct {
9292
Scheduler *Scheduler `json:"scheduler,omitempty" platform:"linux"`
9393
// SelinuxLabel specifies the selinux context that the container process is run as.
9494
SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"`
95+
// IOPriority contains the I/O priority settings for the cgroup.
96+
IOPriority *LinuxIOPriority `json:"ioPriority,omitempty" platform:"linux"`
9597
}
9698

9799
// LinuxCapabilities specifies the list of allowed capabilities that are kept for a process.
@@ -109,6 +111,22 @@ type LinuxCapabilities struct {
109111
Ambient []string `json:"ambient,omitempty" platform:"linux"`
110112
}
111113

114+
// IOPriority represents I/O priority settings for the container's processes within the process group.
115+
type LinuxIOPriority struct {
116+
Class IOPriorityClass `json:"class"`
117+
Priority int `json:"priority"`
118+
}
119+
120+
// IOPriorityClass represents an I/O scheduling class.
121+
type IOPriorityClass string
122+
123+
// Possible values for IOPriorityClass.
124+
const (
125+
IOPRIO_CLASS_RT IOPriorityClass = "IOPRIO_CLASS_RT"
126+
IOPRIO_CLASS_BE IOPriorityClass = "IOPRIO_CLASS_BE"
127+
IOPRIO_CLASS_IDLE IOPriorityClass = "IOPRIO_CLASS_IDLE"
128+
)
129+
112130
// Box specifies dimensions of a rectangle. Used for specifying the size of a console.
113131
type Box struct {
114132
// Height is the vertical dimension of a box.

0 commit comments

Comments
 (0)