Skip to content

Commit 4b42ec4

Browse files
authored
Merge pull request #648 from hqhq/all_negative_value
Allow negative value for some resource fields
2 parents 7dce97b + 082e93a commit 4b42ec4

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

config-linux.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,15 @@ For more information, see [the memory cgroup man page][cgroup-v1-memory].
283283

284284
The following parameters can be specified to setup the controller:
285285

286-
* **`limit`** *(uint64, OPTIONAL)* - sets limit of memory usage in bytes
286+
* **`limit`** *(int64, OPTIONAL)* - sets limit of memory usage in bytes
287287

288-
* **`reservation`** *(uint64, OPTIONAL)* - sets soft limit of memory usage in bytes
288+
* **`reservation`** *(int64, OPTIONAL)* - sets soft limit of memory usage in bytes
289289

290-
* **`swap`** *(uint64, OPTIONAL)* - sets limit of memory+Swap usage
290+
* **`swap`** *(int64, OPTIONAL)* - sets limit of memory+Swap usage
291291

292-
* **`kernel`** *(uint64, OPTIONAL)* - sets hard limit for kernel memory
292+
* **`kernel`** *(int64, OPTIONAL)* - sets hard limit for kernel memory
293293

294-
* **`kernelTCP`** *(uint64, OPTIONAL)* - sets hard limit in bytes for kernel TCP buffer memory
294+
* **`kernelTCP`** *(int64, OPTIONAL)* - sets hard limit in bytes for kernel TCP buffer memory
295295

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

@@ -317,11 +317,11 @@ The following parameters can be specified to setup the controller:
317317

318318
* **`shares`** *(uint64, OPTIONAL)* - specifies a relative share of CPU time available to the tasks in a cgroup
319319

320-
* **`quota`** *(uint64, OPTIONAL)* - specifies the total amount of time in microseconds for which all tasks in a cgroup can run during one period (as defined by **`period`** below)
320+
* **`quota`** *(int64, OPTIONAL)* - specifies the total amount of time in microseconds for which all tasks in a cgroup can run during one period (as defined by **`period`** below)
321321

322322
* **`period`** *(uint64, OPTIONAL)* - specifies a period of time in microseconds for how regularly a cgroup's access to CPU resources should be reallocated (CFS scheduler only)
323323

324-
* **`realtimeRuntime`** *(uint64, OPTIONAL)* - specifies a period of time in microseconds for the longest continuous period in which the tasks in a cgroup have access to CPU resources
324+
* **`realtimeRuntime`** *(int64, OPTIONAL)* - specifies a period of time in microseconds for the longest continuous period in which the tasks in a cgroup have access to CPU resources
325325

326326
* **`realtimePeriod`** *(uint64, OPTIONAL)* - same as **`period`** but applies to realtime scheduler only
327327

@@ -412,15 +412,15 @@ Each entry has the following structure:
412412

413413
* **`pageSize`** *(string, REQUIRED)* - hugepage size
414414

415-
* **`limit`** *(uint64, REQUIRED)* - limit in bytes of *hugepagesize* HugeTLB usage
415+
* **`limit`** *(int64, REQUIRED)* - limit in bytes of *hugepagesize* HugeTLB usage
416416

417417
###### Example
418418

419419
```json
420420
"hugepageLimits": [
421421
{
422422
"pageSize": "2MB",
423-
"limit": 9223372036854771712
423+
"limit": 209715200
424424
}
425425
]
426426
```

schema/config-linux.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,15 @@
188188
},
189189
"quota": {
190190
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/quota",
191-
"$ref": "defs.json#/definitions/uint64Pointer"
191+
"$ref": "defs.json#/definitions/int64Pointer"
192192
},
193193
"realtimePeriod": {
194194
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimePeriod",
195195
"$ref": "defs.json#/definitions/uint64Pointer"
196196
},
197197
"realtimeRuntime": {
198198
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimeRuntime",
199-
"$ref": "defs.json#/definitions/uint64Pointer"
199+
"$ref": "defs.json#/definitions/int64Pointer"
200200
},
201201
"shares": {
202202
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/shares",
@@ -220,7 +220,7 @@
220220
"type": "string"
221221
},
222222
"limit": {
223-
"$ref": "defs.json#/definitions/uint64"
223+
"$ref": "defs.json#/definitions/int64"
224224
}
225225
}
226226
}
@@ -236,19 +236,19 @@
236236
"properties": {
237237
"kernel": {
238238
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel",
239-
"$ref": "defs.json#/definitions/uint64Pointer"
239+
"$ref": "defs.json#/definitions/int64Pointer"
240240
},
241241
"limit": {
242242
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit",
243-
"$ref": "defs.json#/definitions/uint64Pointer"
243+
"$ref": "defs.json#/definitions/int64Pointer"
244244
},
245245
"reservation": {
246246
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation",
247-
"$ref": "defs.json#/definitions/uint64Pointer"
247+
"$ref": "defs.json#/definitions/int64Pointer"
248248
},
249249
"swap": {
250250
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap",
251-
"$ref": "defs.json#/definitions/uint64Pointer"
251+
"$ref": "defs.json#/definitions/int64Pointer"
252252
},
253253
"swappiness": {
254254
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness",

specs-go/config.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ type LinuxHugepageLimit struct {
210210
// Pagesize is the hugepage size
211211
Pagesize string `json:"pageSize"`
212212
// Limit is the limit of "hugepagesize" hugetlb usage
213-
Limit uint64 `json:"limit"`
213+
Limit int64 `json:"limit"`
214214
}
215215

216216
// LinuxInterfacePriority for network interfaces
@@ -266,15 +266,15 @@ type LinuxBlockIO struct {
266266
// LinuxMemory for Linux cgroup 'memory' resource management
267267
type LinuxMemory struct {
268268
// Memory limit (in bytes).
269-
Limit *uint64 `json:"limit,omitempty"`
269+
Limit *int64 `json:"limit,omitempty"`
270270
// Memory reservation or soft_limit (in bytes).
271-
Reservation *uint64 `json:"reservation,omitempty"`
271+
Reservation *int64 `json:"reservation,omitempty"`
272272
// Total memory limit (memory + swap).
273-
Swap *uint64 `json:"swap,omitempty"`
273+
Swap *int64 `json:"swap,omitempty"`
274274
// Kernel memory limit (in bytes).
275-
Kernel *uint64 `json:"kernel,omitempty"`
275+
Kernel *int64 `json:"kernel,omitempty"`
276276
// Kernel memory limit for tcp (in bytes)
277-
KernelTCP *uint64 `json:"kernelTCP,omitempty"`
277+
KernelTCP *int64 `json:"kernelTCP,omitempty"`
278278
// How aggressive the kernel will swap memory pages. Range from 0 to 100.
279279
Swappiness *uint64 `json:"swappiness,omitempty"`
280280
}
@@ -284,11 +284,11 @@ type LinuxCPU struct {
284284
// CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
285285
Shares *uint64 `json:"shares,omitempty"`
286286
// CPU hardcap limit (in usecs). Allowed cpu time in a given period.
287-
Quota *uint64 `json:"quota,omitempty"`
287+
Quota *int64 `json:"quota,omitempty"`
288288
// CPU period to be used for hardcapping (in usecs).
289289
Period *uint64 `json:"period,omitempty"`
290290
// How much time realtime scheduling may use (in usecs).
291-
RealtimeRuntime *uint64 `json:"realtimeRuntime,omitempty"`
291+
RealtimeRuntime *int64 `json:"realtimeRuntime,omitempty"`
292292
// CPU period to be used for realtime scheduling (in usecs).
293293
RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"`
294294
// CPUs to use within the cpuset. Default is to use any CPU available.

0 commit comments

Comments
 (0)