Skip to content

Commit a7bc89b

Browse files
author
Mrunal Patel
authored
Merge pull request #896 from wking/disable-oom-killer-under-memory
config-linux: Move 'disableOOMKiller' under 'memory'
2 parents 06c488c + ef51409 commit a7bc89b

File tree

5 files changed

+19
-29
lines changed

5 files changed

+19
-29
lines changed

config-linux.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -253,22 +253,6 @@ Each entry has the following structure:
253253
]
254254
```
255255

256-
### <a name="configLinuxDisableOutOfMemoryKiller" />Disable out-of-memory killer
257-
258-
`disableOOMKiller` contains a boolean (`true` or `false`) that enables or disables the Out of Memory killer for a cgroup.
259-
If enabled (`false`), tasks that attempt to consume more memory than they are allowed are immediately killed by the OOM killer.
260-
The OOM killer is enabled by default in every cgroup using the `memory` subsystem.
261-
To disable it, specify a value of `true`.
262-
For more information, see the kernel cgroups documentation about [memory][cgroup-v1-memory].
263-
264-
* **`disableOOMKiller`** *(bool, OPTIONAL)* - enables or disables the OOM killer
265-
266-
#### Example
267-
268-
```json
269-
"disableOOMKiller": false
270-
```
271-
272256
### <a name="configLinuxMemory" />Memory
273257

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

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

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

289278
#### Example
290279

@@ -295,7 +284,8 @@ For `swappiness` the values are from 0 to 100. Higher means more swappy.
295284
"swap": 536870912,
296285
"kernel": -1,
297286
"kernelTCP": -1,
298-
"swappiness": 0
287+
"swappiness": 0,
288+
"disableOOMKiller": false
299289
}
300290
```
301291

config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ For Linux-based systems, the `process` object supports the following process-spe
202202
If `oomScoreAdj` is set, the runtime MUST set `oom_score_adj` to the given value.
203203
If `oomScoreAdj` is not set, the runtime MUST NOT change the value of `oom_score_adj`.
204204

205-
This is a per-process setting, where as [`disableOOMKiller`](config-linux.md#disable-out-of-memory-killer) is scoped for a memory cgroup.
205+
This is a per-process setting, where as [`disableOOMKiller`](config-linux.md#memory) is scoped for a memory cgroup.
206206
For more information on how these two settings work together, see [the memory cgroup documentation section 10. OOM Contol][cgroup-v1-memory_2].
207207
* **`selinuxLabel`** (string, OPTIONAL) specifies the SELinux label for the process.
208208
For more information about SELinux, see [SELinux documentation][selinux].
@@ -710,7 +710,8 @@ Here is a full example `config.json` for reference.
710710
"swap": 536870912,
711711
"kernel": -1,
712712
"kernelTCP": -1,
713-
"swappiness": 0
713+
"swappiness": 0,
714+
"disableOOMKiller": false
714715
},
715716
"cpu": {
716717
"shares": 1024,
@@ -721,7 +722,6 @@ Here is a full example `config.json` for reference.
721722
"cpus": "2-3",
722723
"mems": "0-7"
723724
},
724-
"disableOOMKiller": false,
725725
"devices": [
726726
{
727727
"allow": false,

schema/config-linux.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@
143143
}
144144
}
145145
},
146-
"disableOOMKiller": {
147-
"id": "https://opencontainers.org/schema/bundle/linux/resources/disableOOMKiller",
148-
"type": "boolean"
149-
},
150146
"hugepageLimits": {
151147
"id": "https://opencontainers.org/schema/bundle/linux/resources/hugepageLimits",
152148
"type": "array",
@@ -193,6 +189,10 @@
193189
"swappiness": {
194190
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness",
195191
"$ref": "defs.json#/definitions/uint64"
192+
},
193+
"disableOOMKiller": {
194+
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/disableOOMKiller",
195+
"type": "boolean"
196196
}
197197
}
198198
},

schema/test/config/good/spec-example.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@
241241
"swap": 536870912,
242242
"kernel": -1,
243243
"kernelTCP": -1,
244-
"swappiness": 0
244+
"swappiness": 0,
245+
"disableOOMKiller": false
245246
},
246247
"cpu": {
247248
"shares": 1024,
@@ -252,7 +253,6 @@
252253
"cpus": "2-3",
253254
"mems": "0-7"
254255
},
255-
"disableOOMKiller": false,
256256
"devices": [
257257
{
258258
"allow": false,

specs-go/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ type LinuxMemory struct {
284284
KernelTCP *int64 `json:"kernelTCP,omitempty"`
285285
// How aggressive the kernel will swap memory pages.
286286
Swappiness *uint64 `json:"swappiness,omitempty"`
287+
// DisableOOMKiller disables the OOM killer for out of memory conditions
288+
DisableOOMKiller *bool `json:"disableOOMKiller,omitempty"`
287289
}
288290

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

0 commit comments

Comments
 (0)