Skip to content
This repository was archived by the owner on Mar 11, 2020. It is now read-only.

Commit a45ba09

Browse files
authored
Merge pull request #1 from tiborvass/cp876
[17.06.1] Make Linux memory allocations int64 not uint64
2 parents 035da1d + 5f473f3 commit a45ba09

4 files changed

Lines changed: 22 additions & 24 deletions

File tree

config-linux.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,15 @@ For more information on how these two settings work together, see [the memory cg
283283
**`memory`** (object, OPTIONAL) represents the cgroup subsystem `memory` and it's used to set limits on the container's memory usage.
284284
For more information, see [the memory cgroup man page][cgroup-v1-memory].
285285

286-
The following parameters can be specified to setup the controller:
287-
288-
* **`limit`** *(uint64, OPTIONAL)* - sets limit of memory usage in bytes
289-
290-
* **`reservation`** *(uint64, OPTIONAL)* - sets soft limit of memory usage in bytes
291-
292-
* **`swap`** *(uint64, OPTIONAL)* - sets limit of memory+Swap usage
286+
Values for memory specify the limit in bytes, or `-1` for unlimited memory.
293287

294-
* **`kernel`** *(uint64, OPTIONAL)* - sets hard limit for kernel memory
288+
* **`limit`** *(int64, OPTIONAL)* - sets limit of memory usage
289+
* **`reservation`** *(int64, OPTIONAL)* - sets soft limit of memory usage
290+
* **`swap`** *(int64, OPTIONAL)* - sets limit of memory+Swap usage
291+
* **`kernel`** *(int64, OPTIONAL)* - sets hard limit for kernel memory
292+
* **`kernelTCP`** *(int64, OPTIONAL)* - sets hard limit for kernel TCP buffer memory
295293

296-
* **`kernelTCP`** *(uint64, OPTIONAL)* - sets hard limit in bytes for kernel TCP buffer memory
294+
For `swappiness` the values are from 0 to 100. Higher means more swappy.
297295

298296
* **`swappiness`** *(uint64, OPTIONAL)* - sets swappiness parameter of vmscan (See sysctl's vm.swappiness)
299297

@@ -304,8 +302,8 @@ The following parameters can be specified to setup the controller:
304302
"limit": 536870912,
305303
"reservation": 536870912,
306304
"swap": 536870912,
307-
"kernel": 0,
308-
"kernelTCP": 0,
305+
"kernel": -1,
306+
"kernelTCP": -1,
309307
"swappiness": 0
310308
}
311309
```

config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,8 @@ Here is a full example `config.json` for reference.
687687
"limit": 536870912,
688688
"reservation": 536870912,
689689
"swap": 536870912,
690-
"kernel": 0,
691-
"kernelTCP": 0,
690+
"kernel": -1,
691+
"kernelTCP": -1,
692692
"swappiness": 0
693693
},
694694
"cpu": {

schema/config-linux.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,23 +178,23 @@
178178
"properties": {
179179
"kernel": {
180180
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel",
181-
"$ref": "defs.json#/definitions/uint64"
181+
"$ref": "defs.json#/definitions/int64"
182182
},
183183
"kernelTCP": {
184184
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernelTCP",
185-
"$ref": "defs.json#/definitions/uint64"
185+
"$ref": "defs.json#/definitions/int64"
186186
},
187187
"limit": {
188188
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit",
189-
"$ref": "defs.json#/definitions/uint64"
189+
"$ref": "defs.json#/definitions/int64"
190190
},
191191
"reservation": {
192192
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation",
193-
"$ref": "defs.json#/definitions/uint64"
193+
"$ref": "defs.json#/definitions/int64"
194194
},
195195
"swap": {
196196
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap",
197-
"$ref": "defs.json#/definitions/uint64"
197+
"$ref": "defs.json#/definitions/int64"
198198
},
199199
"swappiness": {
200200
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness",

specs-go/config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,16 +281,16 @@ type LinuxBlockIO struct {
281281
// LinuxMemory for Linux cgroup 'memory' resource management
282282
type LinuxMemory struct {
283283
// Memory limit (in bytes).
284-
Limit *uint64 `json:"limit,omitempty"`
284+
Limit *int64 `json:"limit,omitempty"`
285285
// Memory reservation or soft_limit (in bytes).
286-
Reservation *uint64 `json:"reservation,omitempty"`
286+
Reservation *int64 `json:"reservation,omitempty"`
287287
// Total memory limit (memory + swap).
288-
Swap *uint64 `json:"swap,omitempty"`
288+
Swap *int64 `json:"swap,omitempty"`
289289
// Kernel memory limit (in bytes).
290-
Kernel *uint64 `json:"kernel,omitempty"`
290+
Kernel *int64 `json:"kernel,omitempty"`
291291
// Kernel memory limit for tcp (in bytes)
292-
KernelTCP *uint64 `json:"kernelTCP,omitempty"`
293-
// How aggressive the kernel will swap memory pages. Range from 0 to 100.
292+
KernelTCP *int64 `json:"kernelTCP,omitempty"`
293+
// How aggressive the kernel will swap memory pages.
294294
Swappiness *uint64 `json:"swappiness,omitempty"`
295295
}
296296

0 commit comments

Comments
 (0)