Skip to content

Commit

Permalink
Merge pull request #648 from hqhq/all_negative_value
Browse files Browse the repository at this point in the history
Allow negative value for some resource fields
  • Loading branch information
hqhq committed Jan 10, 2017
2 parents 7dce97b + 082e93a commit 4b42ec4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions config-linux.md
Expand Up @@ -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: 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) * **`swappiness`** *(uint64, OPTIONAL)* - sets swappiness parameter of vmscan (See sysctl's vm.swappiness)


Expand All @@ -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 * **`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) * **`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 * **`realtimePeriod`** *(uint64, OPTIONAL)* - same as **`period`** but applies to realtime scheduler only


Expand Down Expand Up @@ -412,15 +412,15 @@ Each entry has the following structure:


* **`pageSize`** *(string, REQUIRED)* - hugepage size * **`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 ###### Example


```json ```json
"hugepageLimits": [ "hugepageLimits": [
{ {
"pageSize": "2MB", "pageSize": "2MB",
"limit": 9223372036854771712 "limit": 209715200
} }
] ]
``` ```
Expand Down
14 changes: 7 additions & 7 deletions schema/config-linux.json
Expand Up @@ -188,15 +188,15 @@
}, },
"quota": { "quota": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/quota", "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/quota",
"$ref": "defs.json#/definitions/uint64Pointer" "$ref": "defs.json#/definitions/int64Pointer"
}, },
"realtimePeriod": { "realtimePeriod": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimePeriod", "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimePeriod",
"$ref": "defs.json#/definitions/uint64Pointer" "$ref": "defs.json#/definitions/uint64Pointer"
}, },
"realtimeRuntime": { "realtimeRuntime": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimeRuntime", "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimeRuntime",
"$ref": "defs.json#/definitions/uint64Pointer" "$ref": "defs.json#/definitions/int64Pointer"
}, },
"shares": { "shares": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/shares", "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/shares",
Expand All @@ -220,7 +220,7 @@
"type": "string" "type": "string"
}, },
"limit": { "limit": {
"$ref": "defs.json#/definitions/uint64" "$ref": "defs.json#/definitions/int64"
} }
} }
} }
Expand All @@ -236,19 +236,19 @@
"properties": { "properties": {
"kernel": { "kernel": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel", "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel",
"$ref": "defs.json#/definitions/uint64Pointer" "$ref": "defs.json#/definitions/int64Pointer"
}, },
"limit": { "limit": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit", "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit",
"$ref": "defs.json#/definitions/uint64Pointer" "$ref": "defs.json#/definitions/int64Pointer"
}, },
"reservation": { "reservation": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation", "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation",
"$ref": "defs.json#/definitions/uint64Pointer" "$ref": "defs.json#/definitions/int64Pointer"
}, },
"swap": { "swap": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap", "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap",
"$ref": "defs.json#/definitions/uint64Pointer" "$ref": "defs.json#/definitions/int64Pointer"
}, },
"swappiness": { "swappiness": {
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness", "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness",
Expand Down
16 changes: 8 additions & 8 deletions specs-go/config.go
Expand Up @@ -210,7 +210,7 @@ type LinuxHugepageLimit struct {
// Pagesize is the hugepage size // Pagesize is the hugepage size
Pagesize string `json:"pageSize"` Pagesize string `json:"pageSize"`
// Limit is the limit of "hugepagesize" hugetlb usage // Limit is the limit of "hugepagesize" hugetlb usage
Limit uint64 `json:"limit"` Limit int64 `json:"limit"`
} }


// LinuxInterfacePriority for network interfaces // LinuxInterfacePriority for network interfaces
Expand Down Expand Up @@ -266,15 +266,15 @@ type LinuxBlockIO struct {
// LinuxMemory for Linux cgroup 'memory' resource management // LinuxMemory for Linux cgroup 'memory' resource management
type LinuxMemory struct { type LinuxMemory struct {
// Memory limit (in bytes). // Memory limit (in bytes).
Limit *uint64 `json:"limit,omitempty"` Limit *int64 `json:"limit,omitempty"`
// Memory reservation or soft_limit (in bytes). // Memory reservation or soft_limit (in bytes).
Reservation *uint64 `json:"reservation,omitempty"` Reservation *int64 `json:"reservation,omitempty"`
// Total memory limit (memory + swap). // Total memory limit (memory + swap).
Swap *uint64 `json:"swap,omitempty"` Swap *int64 `json:"swap,omitempty"`
// Kernel memory limit (in bytes). // Kernel memory limit (in bytes).
Kernel *uint64 `json:"kernel,omitempty"` Kernel *int64 `json:"kernel,omitempty"`
// Kernel memory limit for tcp (in bytes) // 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. // How aggressive the kernel will swap memory pages. Range from 0 to 100.
Swappiness *uint64 `json:"swappiness,omitempty"` Swappiness *uint64 `json:"swappiness,omitempty"`
} }
Expand All @@ -284,11 +284,11 @@ type LinuxCPU struct {
// CPU shares (relative weight (ratio) vs. other cgroups with cpu shares). // CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
Shares *uint64 `json:"shares,omitempty"` Shares *uint64 `json:"shares,omitempty"`
// CPU hardcap limit (in usecs). Allowed cpu time in a given period. // 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). // CPU period to be used for hardcapping (in usecs).
Period *uint64 `json:"period,omitempty"` Period *uint64 `json:"period,omitempty"`
// How much time realtime scheduling may use (in usecs). // 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). // CPU period to be used for realtime scheduling (in usecs).
RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"` RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"`
// CPUs to use within the cpuset. Default is to use any CPU available. // CPUs to use within the cpuset. Default is to use any CPU available.
Expand Down

0 comments on commit 4b42ec4

Please sign in to comment.