Skip to content

Commit 504f70e

Browse files
committed
Add I/O Priority Configuration for Process Group in Linux Containers
Signed-off-by: utam0k <[email protected]>
1 parent 8a09257 commit 504f70e

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
@@ -293,6 +293,12 @@ For Linux-based systems, the `process` object supports the following process-spe
293293
For more information on how these two settings work together, see [the memory cgroup documentation section 10. OOM Contol][cgroup-v1-memory_2].
294294
* **`selinuxLabel`** (string, OPTIONAL) specifies the SELinux label for the process.
295295
For more information about SELinux, see [SELinux documentation][selinux].
296+
* **`ioPriority`** (object, OPTIONAL) configures the I/O priority settings for the container's processes within the process group.
297+
The I/O priority settings will be automatically applied to the entire process group, affecting all processes within the container.
298+
The following properties are available:
299+
300+
* **`class`** (string, REQUIRED) specifies the I/O scheduling class. Possible values are `IOPRIO_CLASS_RT`, `IOPRIO_CLASS_BE`, and `IOPRIO_CLASS_IDLE`.
301+
* **`priority`** (int, REQUIRED) specifies the priority level within the class. The value should be an integer ranging from 0 (highest) to 7 (lowest).
296302

297303
### <a name="configUser" />User
298304

@@ -334,6 +340,10 @@ _Note: symbolic name for uid and gid, such as uname and gname respectively, are
334340
],
335341
"apparmorProfile": "acme_secure_profile",
336342
"selinuxLabel": "system_u:system_r:svirt_lxc_net_t:s0:c124,c675",
343+
"ioPriority": {
344+
"class": "IOPRIO_CLASS_IDLE",
345+
"priority": 4
346+
},
337347
"noNewPrivileges": true,
338348
"capabilities": {
339349
"bounding": [
@@ -734,6 +744,10 @@ Here is a full example `config.json` for reference.
734744
"apparmorProfile": "acme_secure_profile",
735745
"oomScoreAdj": 100,
736746
"selinuxLabel": "system_u:system_r:svirt_lxc_net_t:s0:c124,c675",
747+
"ioPriority": {
748+
"class": "IOPRIO_CLASS_IDLE",
749+
"priority": 4
750+
},
737751
"noNewPrivileges": true
738752
},
739753
"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
@@ -62,6 +62,8 @@ type Process struct {
6262
OOMScoreAdj *int `json:"oomScoreAdj,omitempty" platform:"linux"`
6363
// SelinuxLabel specifies the selinux context that the container process is run as.
6464
SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"`
65+
// IOPriority contains the I/O priority settings for the cgroup.
66+
IOPriority *LinuxIOPriority `json:"ioPriority,omitempty" platform:"linux"`
6567
}
6668

6769
// LinuxCapabilities specifies the list of allowed capabilities that are kept for a process.
@@ -79,6 +81,22 @@ type LinuxCapabilities struct {
7981
Ambient []string `json:"ambient,omitempty" platform:"linux"`
8082
}
8183

84+
// IOPriority represents I/O priority settings for the container's processes within the process group.
85+
type LinuxIOPriority struct {
86+
Class IOPriorityClass `json:"class"`
87+
Priority int `json:"priority"`
88+
}
89+
90+
// IOPriorityClass represents an I/O scheduling class.
91+
type IOPriorityClass string
92+
93+
// Possible values for IOPriorityClass.
94+
const (
95+
IOPRIO_CLASS_RT IOPriorityClass = "IOPRIO_CLASS_RT"
96+
IOPRIO_CLASS_BE IOPriorityClass = "IOPRIO_CLASS_BE"
97+
IOPRIO_CLASS_IDLE IOPriorityClass = "IOPRIO_CLASS_IDLE"
98+
)
99+
82100
// Box specifies dimensions of a rectangle. Used for specifying the size of a console.
83101
type Box struct {
84102
// Height is the vertical dimension of a box.

0 commit comments

Comments
 (0)