Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,18 +340,35 @@ For Linux-based systems, the `process` object supports the following process-spe

* **`class`** (string, REQUIRED) specifies the I/O scheduling class. Possible values are `IOPRIO_CLASS_RT`, `IOPRIO_CLASS_BE`, and `IOPRIO_CLASS_IDLE`.
* **`priority`** (int, REQUIRED) specifies the priority level within the class. The value should be an integer ranging from 0 (highest) to 7 (lowest).
* **`execCPUAffinity`** (object, OPTIONAL) specifies CPU affinity used to execute the process.
* **`cpuAffinity`** (object, OPTIONAL) specifies CPU affinity used to execute processes in the runtime and the container.
All the properties in this setting expects as argument a string that contain a comma-separated list, with dashes to represent ranges.
For example, `0-3,7` represents CPUs 0,1,2,3, and 7. Special value `all` can be used to reset CPU affinity to the value that includes all possible CPUs in the system.
If omitted or empty for particular [lifecycle](runtime.md#lifecycle) stage, the runtime SHOULD NOT change process' CPU affinity, and the actual affinity is determined by the Linux kernel.
The following properties are available:
* **`createRuntime`** (string, OPTIONAL) is a list of CPUs the runtime parent process should run on during the runtime creation stage, before entering the container's namespaces or cgroups.
CPU affinity should be applied on early stages of container creation, so that any potential CPU consuming operations inside runtime (e.g. [`createRuntime` hooks](#createRuntime-hooks)) will be run on the specified list of CPUs.
* **`createContainer`** (string, OPTIONAL) is a list of CPUs the process should run on during the container creation stage, after entering the container's namespaces but before the user process or any of [`createContainer` hooks](#createContainer-hooks) are executed.
* **`startContainer`** (string, OPTIONAL) is a list of CPUs the process should be run on during the container start stage, inside the container's namespace during `start` operation. The affinity should be applied before executing [`startContainer` hooks](#startContainer-hooks).
* **`execRuntime`** (string, OPTIONAL) is a list of CPUs the runtime parent process to be run during `exec` operation, before the transition to container's cgroup.
* **`execContainer`** (string, OPTIONAL) is a list of CPUs the process will be run on during `exec` operationon after the transition to container's cgroup.
* **`execCPUAffinity`** (object, OPTIONAL, **DEPRECATED**) specifies CPU affinity used to execute the process.

Note: `execCPUAffinity` is deprecated in favor of `cpuAffinity`. If `cpuAffinity` is specified and supported by the runtime, the content of `execCPUAffinity` should be ignored.

This setting is not applicable to the container's init process.
The following properties are available:
* **`initial`** (string, OPTIONAL) is a list of CPUs a runtime parent
process to be run on initially, before the transition to container's
cgroup. This is a a comma-separated list, with dashes to represent
ranges. For example, `0-3,7` represents CPUs 0,1,2,3, and 7.
Deprecated in favor of `execRuntime` in `cpuAffinity`.
* **`final`** (string, OPTIONAL) is a list of CPUs the process will be run
on after the transition to container's cgroup. The format is the same as
for `initial`. If omitted or empty, runtime SHOULD NOT change process'
CPU affinity after the process is moved to container's cgroup, and the
final affinity is determined by the Linux kernel.
Deprecated in favor of `execContainer` in `cpuAffinity`.


### <a name="configZOSProcess" />z/OS Process

Expand Down Expand Up @@ -435,9 +452,12 @@ _Note: symbolic name for uid and gid, such as uname and gname respectively, are
"soft": 1024
}
],
"execCPUAffinity": {
"initial": "7",
"final": "0-3,7"
"cpuAffinity": {
"createRuntime": "7",
"createContainer": "all",
"startContainer": "0-3,7",
"execRuntime": "7",
"execContainer": "0-3,7"
}
}
```
Expand Down
25 changes: 25 additions & 0 deletions schema/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,31 @@
}
}
},
"cpuAffinity": {
"type": "object",
"properties": {
"createRuntime": {
"type": "string",
"pattern": "^([0-9, -]*|all)$"
},
"createContainer": {
"type": "string",
"pattern": "^([0-9, -]*|all)$"
},
"startContainer": {
"type": "string",
"pattern": "^([0-9, -]*|all)$"
},
"execRuntime": {
"type": "string",
"pattern": "^([0-9, -]*|all)$"
},
"execContainer": {
"type": "string",
"pattern": "^([0-9, -]*|all)$"
}
}
},
"execCPUAffinity": {
"type": "object",
"properties": {
Expand Down
22 changes: 18 additions & 4 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,13 @@ type Process struct {
SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"`
// IOPriority contains the I/O priority settings for the cgroup.
IOPriority *LinuxIOPriority `json:"ioPriority,omitempty" platform:"linux"`
// ExecCPUAffinity specifies CPU affinity for exec processes.
ExecCPUAffinity *CPUAffinity `json:"execCPUAffinity,omitempty" platform:"linux"`
// ExecCPUAffinity is Deprecated. ExecCPUAffinity specifies CPU affinity for exec processes.
//
// Deprecated: use [Process.CPUAffinity] instead, which allows more granular control
// during the create, start and exec phases.
ExecCPUAffinity *ExecCPUAffinity `json:"execCPUAffinity,omitempty" platform:"linux"`
// CPUAffinity specifies CPU affinity for executing processes
CPUAffinity *CPUAffinity `json:"cpuAffinity,omitempty" platform:"linux"`
}

// LinuxCapabilities specifies the list of allowed capabilities that are kept for a process.
Expand Down Expand Up @@ -131,12 +136,21 @@ const (
IOPRIO_CLASS_IDLE IOPriorityClass = "IOPRIO_CLASS_IDLE"
)

// CPUAffinity specifies process' CPU affinity.
type CPUAffinity struct {
// ExecCPUAffinity specifies process' CPU affinity during runtime exec operation.
type ExecCPUAffinity struct {
Initial string `json:"initial,omitempty"`
Final string `json:"final,omitempty"`
}

// CPUAffinity specifies process' CPU affinity.
type CPUAffinity struct {
CreateRuntime string `json:"createRuntime,omitempty"`
CreateContainer string `json:"createContainer,omitempty"`
StartContainer string `json:"startContainer,omitempty"`
ExecRuntime string `json:"execRuntime,omitempty"`
ExecContainer string `json:"execContainer,omitempty"`
}

// Box specifies dimensions of a rectangle. Used for specifying the size of a console.
type Box struct {
// Height is the vertical dimension of a box.
Expand Down
Loading