Permalink
Browse files

Allow negative value for some resource fields

Carry #499

For these values, cgroup kernal APIs accept -1 to set
them as unlimited, as docker and runc all support
update resources, we should not set drawbacks in spec.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
  • Loading branch information...
1 parent ced3365 commit 082e93a2bd6e72b15adf716c216c126a5b8a1da6 @hqhq hqhq committed Jan 5, 2017
Showing with 24 additions and 24 deletions.
  1. +9 −9 config-linux.md
  2. +7 −7 schema/config-linux.json
  3. +8 −8 specs-go/config.go
View
@@ -283,15 +283,15 @@ For more information, see [the memory cgroup man page][cgroup-v1-memory].
The following parameters can be specified to setup the controller:
-* **`limit`** *(uint64, OPTIONAL)* - sets limit of memory usage in bytes
+* **`limit`** *(int64, OPTIONAL)* - sets limit of memory usage in bytes
-* **`reservation`** *(uint64, OPTIONAL)* - sets soft limit of memory usage in bytes
+* **`reservation`** *(int64, OPTIONAL)* - sets soft limit of memory usage in bytes
-* **`swap`** *(uint64, OPTIONAL)* - sets limit of memory+Swap usage
+* **`swap`** *(int64, OPTIONAL)* - sets limit of memory+Swap usage
-* **`kernel`** *(uint64, OPTIONAL)* - sets hard limit for kernel memory
+* **`kernel`** *(int64, OPTIONAL)* - sets hard limit for kernel memory
-* **`kernelTCP`** *(uint64, OPTIONAL)* - sets hard limit in bytes for kernel TCP buffer memory
+* **`kernelTCP`** *(int64, OPTIONAL)* - sets hard limit in bytes for kernel TCP buffer memory
* **`swappiness`** *(uint64, OPTIONAL)* - sets swappiness parameter of vmscan (See sysctl's vm.swappiness)
@@ -317,11 +317,11 @@ The following parameters can be specified to setup the controller:
* **`shares`** *(uint64, OPTIONAL)* - specifies a relative share of CPU time available to the tasks in a cgroup
-* **`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)
+* **`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)
* **`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)
-* **`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
+* **`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
* **`realtimePeriod`** *(uint64, OPTIONAL)* - same as **`period`** but applies to realtime scheduler only
@@ -412,15 +412,15 @@ Each entry has the following structure:
* **`pageSize`** *(string, REQUIRED)* - hugepage size
-* **`limit`** *(uint64, REQUIRED)* - limit in bytes of *hugepagesize* HugeTLB usage
+* **`limit`** *(int64, REQUIRED)* - limit in bytes of *hugepagesize* HugeTLB usage
###### Example
```json
"hugepageLimits": [
{
"pageSize": "2MB",
- "limit": 9223372036854771712
+ "limit": 209715200
}
]
```
@@ -188,15 +188,15 @@
},
"quota": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/quota",
- "$ref": "defs.json#/definitions/uint64Pointer"
+ "$ref": "defs.json#/definitions/int64Pointer"
},
"realtimePeriod": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimePeriod",
"$ref": "defs.json#/definitions/uint64Pointer"
},
"realtimeRuntime": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimeRuntime",
- "$ref": "defs.json#/definitions/uint64Pointer"
+ "$ref": "defs.json#/definitions/int64Pointer"
},
"shares": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/shares",
@@ -220,7 +220,7 @@
"type": "string"
},
"limit": {
- "$ref": "defs.json#/definitions/uint64"
+ "$ref": "defs.json#/definitions/int64"
}
}
}
@@ -236,19 +236,19 @@
"properties": {
"kernel": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel",
- "$ref": "defs.json#/definitions/uint64Pointer"
+ "$ref": "defs.json#/definitions/int64Pointer"
},
"limit": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit",
- "$ref": "defs.json#/definitions/uint64Pointer"
+ "$ref": "defs.json#/definitions/int64Pointer"
},
"reservation": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation",
- "$ref": "defs.json#/definitions/uint64Pointer"
+ "$ref": "defs.json#/definitions/int64Pointer"
},
"swap": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap",
- "$ref": "defs.json#/definitions/uint64Pointer"
+ "$ref": "defs.json#/definitions/int64Pointer"
},
"swappiness": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness",
View
@@ -210,7 +210,7 @@ type LinuxHugepageLimit struct {
// Pagesize is the hugepage size
Pagesize string `json:"pageSize"`
// Limit is the limit of "hugepagesize" hugetlb usage
- Limit uint64 `json:"limit"`
+ Limit int64 `json:"limit"`
}
// LinuxInterfacePriority for network interfaces
@@ -266,15 +266,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. Range from 0 to 100.
Swappiness *uint64 `json:"swappiness,omitempty"`
}
@@ -284,11 +284,11 @@ type LinuxCPU struct {
// CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
Shares *uint64 `json:"shares,omitempty"`
// CPU hardcap limit (in usecs). Allowed cpu time in a given period.
- Quota *uint64 `json:"quota,omitempty"`
+ Quota *int64 `json:"quota,omitempty"`
// CPU period to be used for hardcapping (in usecs).
Period *uint64 `json:"period,omitempty"`
// How much time realtime scheduling may use (in usecs).
- RealtimeRuntime *uint64 `json:"realtimeRuntime,omitempty"`
+ RealtimeRuntime *int64 `json:"realtimeRuntime,omitempty"`
// CPU period to be used for realtime scheduling (in usecs).
RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"`
// CPUs to use within the cpuset. Default is to use any CPU available.

0 comments on commit 082e93a

Please sign in to comment.