diff --git a/config-linux.md b/config-linux.md index 8d65d5499..2b8d86fb9 100644 --- a/config-linux.md +++ b/config-linux.md @@ -270,13 +270,16 @@ For more information, see the kernel cgroups documentation about [memory][cgroup **`memory`** (object, OPTIONAL) represents the cgroup subsystem `memory` and it's used to set limits on the container's memory usage. For more information, see the kernel cgroups documentation about [memory][cgroup-v1-memory]. -The following parameters can be specified to set up the controller: +Values for memory specify the limit in bytes, or `-1` for unlimited memory. + +* **`limit`** *(int64, OPTIONAL)* - sets limit of memory usage +* **`reservation`** *(int64, OPTIONAL)* - sets soft limit of memory usage +* **`swap`** *(int64, OPTIONAL)* - sets limit of memory+Swap usage +* **`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. -* **`limit`** *(uint64, OPTIONAL)* - sets limit of memory usage in bytes -* **`reservation`** *(uint64, OPTIONAL)* - sets soft limit of memory usage in bytes -* **`swap`** *(uint64, OPTIONAL)* - sets limit of memory+Swap usage -* **`kernel`** *(uint64, OPTIONAL)* - sets hard limit for kernel memory -* **`kernelTCP`** *(uint64, OPTIONAL)* - sets hard limit in bytes for kernel TCP buffer memory * **`swappiness`** *(uint64, OPTIONAL)* - sets swappiness parameter of vmscan (See sysctl's vm.swappiness) #### Example @@ -286,8 +289,8 @@ The following parameters can be specified to set up the controller: "limit": 536870912, "reservation": 536870912, "swap": 536870912, - "kernel": 0, - "kernelTCP": 0, + "kernel": -1, + "kernelTCP": -1, "swappiness": 0 } ``` diff --git a/config.md b/config.md index c79a6affb..e4d27f599 100644 --- a/config.md +++ b/config.md @@ -689,8 +689,8 @@ Here is a full example `config.json` for reference. "limit": 536870912, "reservation": 536870912, "swap": 536870912, - "kernel": 0, - "kernelTCP": 0, + "kernel": -1, + "kernelTCP": -1, "swappiness": 0 }, "cpu": { diff --git a/schema/config-linux.json b/schema/config-linux.json index 77f8867d9..53bc06c51 100644 --- a/schema/config-linux.json +++ b/schema/config-linux.json @@ -172,23 +172,23 @@ "properties": { "kernel": { "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel", - "$ref": "defs.json#/definitions/uint64" + "$ref": "defs.json#/definitions/int64" }, "kernelTCP": { "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernelTCP", - "$ref": "defs.json#/definitions/uint64" + "$ref": "defs.json#/definitions/int64" }, "limit": { "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit", - "$ref": "defs.json#/definitions/uint64" + "$ref": "defs.json#/definitions/int64" }, "reservation": { "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation", - "$ref": "defs.json#/definitions/uint64" + "$ref": "defs.json#/definitions/int64" }, "swap": { "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap", - "$ref": "defs.json#/definitions/uint64" + "$ref": "defs.json#/definitions/int64" }, "swappiness": { "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness", diff --git a/schema/test/config/good/spec-example.json b/schema/test/config/good/spec-example.json index d6e31201f..50fdbbe8e 100644 --- a/schema/test/config/good/spec-example.json +++ b/schema/test/config/good/spec-example.json @@ -239,8 +239,8 @@ "limit": 536870912, "reservation": 536870912, "swap": 536870912, - "kernel": 0, - "kernelTCP": 0, + "kernel": -1, + "kernelTCP": -1, "swappiness": 0 }, "cpu": { diff --git a/specs-go/config.go b/specs-go/config.go index 01c70b447..68ab112ef 100644 --- a/specs-go/config.go +++ b/specs-go/config.go @@ -273,15 +273,15 @@ type LinuxBlockIO struct { // LinuxMemory for Linux cgroup 'memory' resource management type LinuxMemory struct { // Memory limit (in bytes). - Limit *uint64 `json:"limit,omitempty"` + Limit *int64 `json:"limit,omitempty"` // Memory reservation or soft_limit (in bytes). - Reservation *uint64 `json:"reservation,omitempty"` + Reservation *int64 `json:"reservation,omitempty"` // Total memory limit (memory + swap). - Swap *uint64 `json:"swap,omitempty"` + Swap *int64 `json:"swap,omitempty"` // Kernel memory limit (in bytes). - Kernel *uint64 `json:"kernel,omitempty"` + Kernel *int64 `json:"kernel,omitempty"` // Kernel memory limit for tcp (in bytes) - KernelTCP *uint64 `json:"kernelTCP,omitempty"` + KernelTCP *int64 `json:"kernelTCP,omitempty"` // How aggressive the kernel will swap memory pages. Swappiness *uint64 `json:"swappiness,omitempty"` }