Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config-linux: Move 'disableOOMKiller' under 'memory' #896

Merged
Merged
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
26 changes: 8 additions & 18 deletions config-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,22 +253,6 @@ Each entry has the following structure:
]
```

### <a name="configLinuxDisableOutOfMemoryKiller" />Disable out-of-memory killer

`disableOOMKiller` contains a boolean (`true` or `false`) that enables or disables the Out of Memory killer for a cgroup.
If enabled (`false`), tasks that attempt to consume more memory than they are allowed are immediately killed by the OOM killer.
The OOM killer is enabled by default in every cgroup using the `memory` subsystem.
To disable it, specify a value of `true`.
For more information, see the kernel cgroups documentation about [memory][cgroup-v1-memory].

* **`disableOOMKiller`** *(bool, OPTIONAL)* - enables or disables the OOM killer

#### Example

```json
"disableOOMKiller": false
```

### <a name="configLinuxMemory" />Memory

**`memory`** (object, OPTIONAL) represents the cgroup subsystem `memory` and it's used to set limits on the container's memory usage.
Expand All @@ -282,9 +266,14 @@ Values for memory specify the limit in bytes, or `-1` for unlimited memory.
* **`kernel`** *(int64, OPTIONAL)* - sets hard limit for kernel memory
* **`kernelTCP`** *(int64, OPTIONAL)* - sets hard limit for kernel TCP buffer memory

For `swappiness` the values are from 0 to 100. Higher means more swappy.
The following properties do not specify memory limits, but are covered by the `memory` controller:

* **`swappiness`** *(uint64, OPTIONAL)* - sets swappiness parameter of vmscan (See sysctl's vm.swappiness)
The values are from 0 to 100. Higher means more swappy.
* **`disableOOMKiller`** *(bool, OPTIONAL)* - enables or disables the OOM killer.
If enabled (`false`), tasks that attempt to consume more memory than they are allowed are immediately killed by the OOM killer.
The OOM killer is enabled by default in every cgroup using the `memory` subsystem.
To disable it, specify a value of `true`.

#### Example

Expand All @@ -295,7 +284,8 @@ For `swappiness` the values are from 0 to 100. Higher means more swappy.
"swap": 536870912,
"kernel": -1,
"kernelTCP": -1,
"swappiness": 0
"swappiness": 0,
"disableOOMKiller": false
}
```

Expand Down
6 changes: 3 additions & 3 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ For Linux-based systems, the `process` object supports the following process-spe
If `oomScoreAdj` is set, the runtime MUST set `oom_score_adj` to the given value.
If `oomScoreAdj` is not set, the runtime MUST NOT change the value of `oom_score_adj`.

This is a per-process setting, where as [`disableOOMKiller`](config-linux.md#disable-out-of-memory-killer) is scoped for a memory cgroup.
This is a per-process setting, where as [`disableOOMKiller`](config-linux.md#memory) is scoped for a memory cgroup.
For more information on how these two settings work together, see [the memory cgroup documentation section 10. OOM Contol][cgroup-v1-memory_2].
* **`selinuxLabel`** (string, OPTIONAL) specifies the SELinux label for the process.
For more information about SELinux, see [SELinux documentation][selinux].
Expand Down Expand Up @@ -710,7 +710,8 @@ Here is a full example `config.json` for reference.
"swap": 536870912,
"kernel": -1,
"kernelTCP": -1,
"swappiness": 0
"swappiness": 0,
"disableOOMKiller": false
},
"cpu": {
"shares": 1024,
Expand All @@ -721,7 +722,6 @@ Here is a full example `config.json` for reference.
"cpus": "2-3",
"mems": "0-7"
},
"disableOOMKiller": false,
"devices": [
{
"allow": false,
Expand Down
8 changes: 4 additions & 4 deletions schema/config-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@
}
}
},
"disableOOMKiller": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/disableOOMKiller",
"type": "boolean"
},
"hugepageLimits": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/hugepageLimits",
"type": "array",
Expand Down Expand Up @@ -193,6 +189,10 @@
"swappiness": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness",
"$ref": "defs.json#/definitions/uint64"
},
"disableOOMKiller": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/disableOOMKiller",
"type": "boolean"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions schema/test/config/good/spec-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@
"swap": 536870912,
"kernel": -1,
"kernelTCP": -1,
"swappiness": 0
"swappiness": 0,
"disableOOMKiller": false
},
"cpu": {
"shares": 1024,
Expand All @@ -252,7 +253,6 @@
"cpus": "2-3",
"mems": "0-7"
},
"disableOOMKiller": false,
"devices": [
{
"allow": false,
Expand Down
4 changes: 2 additions & 2 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ type LinuxMemory struct {
KernelTCP *int64 `json:"kernelTCP,omitempty"`
// How aggressive the kernel will swap memory pages.
Swappiness *uint64 `json:"swappiness,omitempty"`
// DisableOOMKiller disables the OOM killer for out of memory conditions
DisableOOMKiller *bool `json:"disableOOMKiller,omitempty"`
}

// LinuxCPU for Linux cgroup 'cpu' resource management
Expand Down Expand Up @@ -322,8 +324,6 @@ type LinuxNetwork struct {
type LinuxResources struct {
// Devices configures the device whitelist.
Devices []LinuxDeviceCgroup `json:"devices,omitempty"`
// DisableOOMKiller disables the OOM killer for out of memory conditions
DisableOOMKiller *bool `json:"disableOOMKiller,omitempty"`
// Memory restriction configuration
Memory *LinuxMemory `json:"memory,omitempty"`
// CPU resource restriction configuration
Expand Down