mirror of https://github.com/docker/cli.git
Implementing support for --cpu-rt-period and --cpu-rt-runtime so that
containers may specify these cgroup values at runtime. This will allow processes to change their priority to real-time within the container when CONFIG_RT_GROUP_SCHED is enabled in the kernel. See #22380. Also added sanity checks for the new --cpu-rt-runtime and --cpu-rt-period flags to ensure that that the kernel supports these features and that runtime is not greater than period. Daemon will support a --cpu-rt-runtime flag to initialize the parent cgroup on startup, this prevents the administrator from alotting runtime to docker after each restart. There are additional checks that could be added but maybe too far? Check parent cgroups to ensure values are <= parent, inspecting rtprio ulimit and issuing a warning. Signed-off-by: Erik St. Martin <alakriti@gmail.com>
This commit is contained in:
parent
85fb527cbf
commit
42ef78911e
|
@ -1316,6 +1316,8 @@ _docker_container_run() {
|
||||||
--cidfile
|
--cidfile
|
||||||
--cpu-period
|
--cpu-period
|
||||||
--cpu-quota
|
--cpu-quota
|
||||||
|
--cpu-rt-period
|
||||||
|
--cpu-rt-runtime
|
||||||
--cpuset-cpus
|
--cpuset-cpus
|
||||||
--cpuset-mems
|
--cpuset-mems
|
||||||
--cpu-shares -c
|
--cpu-shares -c
|
||||||
|
@ -1667,6 +1669,8 @@ _docker_container_update() {
|
||||||
--blkio-weight
|
--blkio-weight
|
||||||
--cpu-period
|
--cpu-period
|
||||||
--cpu-quota
|
--cpu-quota
|
||||||
|
--cpu-rt-period
|
||||||
|
--cpu-rt-runtime
|
||||||
--cpuset-cpus
|
--cpuset-cpus
|
||||||
--cpuset-mems
|
--cpuset-mems
|
||||||
--cpu-shares -c
|
--cpu-shares -c
|
||||||
|
|
|
@ -1433,6 +1433,8 @@ __docker_subcommand() {
|
||||||
"($help -c --cpu-shares)"{-c=,--cpu-shares=}"[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)"
|
"($help -c --cpu-shares)"{-c=,--cpu-shares=}"[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)"
|
||||||
"($help)--cpu-period=[Limit the CPU CFS (Completely Fair Scheduler) period]:CPU period: "
|
"($help)--cpu-period=[Limit the CPU CFS (Completely Fair Scheduler) period]:CPU period: "
|
||||||
"($help)--cpu-quota=[Limit the CPU CFS (Completely Fair Scheduler) quota]:CPU quota: "
|
"($help)--cpu-quota=[Limit the CPU CFS (Completely Fair Scheduler) quota]:CPU quota: "
|
||||||
|
"($help)--cpu-rt-period=[Limit the CPU real-time period]:CPU real-time period in microseconds: "
|
||||||
|
"($help)--cpu-rt-runtime=[Limit the CPU real-time runtime]:CPU real-time runtime in microseconds: "
|
||||||
"($help)--cpuset-cpus=[CPUs in which to allow execution]:CPUs: "
|
"($help)--cpuset-cpus=[CPUs in which to allow execution]:CPUs: "
|
||||||
"($help)--cpuset-mems=[MEMs in which to allow execution]:MEMs: "
|
"($help)--cpuset-mems=[MEMs in which to allow execution]:MEMs: "
|
||||||
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
|
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
|
||||||
|
|
|
@ -35,6 +35,8 @@ Options:
|
||||||
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
|
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
|
||||||
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
|
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
|
||||||
-c, --cpu-shares int CPU shares (relative weight)
|
-c, --cpu-shares int CPU shares (relative weight)
|
||||||
|
--cpu-rt-period int Limit the CPU real-time period in microseconds
|
||||||
|
--cpu-rt-runtime int Limit the CPU real-time runtime in microseconds
|
||||||
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
|
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
|
||||||
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
|
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
|
||||||
--device value Add a host device to the container (default [])
|
--device value Add a host device to the container (default [])
|
||||||
|
|
|
@ -33,6 +33,8 @@ Options:
|
||||||
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
|
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
|
||||||
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
|
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
|
||||||
-c, --cpu-shares int CPU shares (relative weight)
|
-c, --cpu-shares int CPU shares (relative weight)
|
||||||
|
--cpu-rt-period int Limit the CPU real-time period in microseconds
|
||||||
|
--cpu-rt-runtime int Limit the CPU real-time runtime in microseconds
|
||||||
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
|
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
|
||||||
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
|
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
|
||||||
-d, --detach Run container in background and print container ID
|
-d, --detach Run container in background and print container ID
|
||||||
|
|
|
@ -25,6 +25,8 @@ Options:
|
||||||
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
|
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
|
||||||
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
|
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
|
||||||
-c, --cpu-shares int CPU shares (relative weight)
|
-c, --cpu-shares int CPU shares (relative weight)
|
||||||
|
--cpu-rt-period int Limit the CPU real-time period in microseconds
|
||||||
|
--cpu-rt-runtime int Limit the CPU real-time runtime in microseconds
|
||||||
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
|
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
|
||||||
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
|
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
|
||||||
--help Print usage
|
--help Print usage
|
||||||
|
|
|
@ -690,6 +690,8 @@ container:
|
||||||
| `--cpuset-cpus=""` | CPUs in which to allow execution (0-3, 0,1) |
|
| `--cpuset-cpus=""` | CPUs in which to allow execution (0-3, 0,1) |
|
||||||
| `--cpuset-mems=""` | Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. |
|
| `--cpuset-mems=""` | Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. |
|
||||||
| `--cpu-quota=0` | Limit the CPU CFS (Completely Fair Scheduler) quota |
|
| `--cpu-quota=0` | Limit the CPU CFS (Completely Fair Scheduler) quota |
|
||||||
|
| `--cpu-rt-period=0` | Limit the CPU real-time period. In microseconds. Requires parent cgroups be set and cannot be higher than parent. Also check rtprio ulimits. |
|
||||||
|
| `--cpu-rt-runtime=0` | Limit the CPU real-time runtime. In microseconds. Requires parent cgroups be set and cannot be higher than parent. Also check rtprio ulimits. |
|
||||||
| `--blkio-weight=0` | Block IO weight (relative weight) accepts a weight value between 10 and 1000. |
|
| `--blkio-weight=0` | Block IO weight (relative weight) accepts a weight value between 10 and 1000. |
|
||||||
| `--blkio-weight-device=""` | Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`) |
|
| `--blkio-weight-device=""` | Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`) |
|
||||||
| `--device-read-bps=""` | Limit read rate from a device (format: `<device-path>:<number>[<unit>]`). Number is a positive integer. Unit can be one of `kb`, `mb`, or `gb`. |
|
| `--device-read-bps=""` | Limit read rate from a device (format: `<device-path>:<number>[<unit>]`). Number is a positive integer. Unit can be one of `kb`, `mb`, or `gb`. |
|
||||||
|
|
|
@ -17,6 +17,8 @@ docker-create - Create a new container
|
||||||
[**--cidfile**[=*CIDFILE*]]
|
[**--cidfile**[=*CIDFILE*]]
|
||||||
[**--cpu-period**[=*0*]]
|
[**--cpu-period**[=*0*]]
|
||||||
[**--cpu-quota**[=*0*]]
|
[**--cpu-quota**[=*0*]]
|
||||||
|
[**--cpu-rt-period**[=*0*]]
|
||||||
|
[**--cpu-rt-runtime**[=*0*]]
|
||||||
[**--cpuset-cpus**[=*CPUSET-CPUS*]]
|
[**--cpuset-cpus**[=*CPUSET-CPUS*]]
|
||||||
[**--cpuset-mems**[=*CPUSET-MEMS*]]
|
[**--cpuset-mems**[=*CPUSET-MEMS*]]
|
||||||
[**--device**[=*[]*]]
|
[**--device**[=*[]*]]
|
||||||
|
@ -123,6 +125,8 @@ The initial status of the container created with **docker create** is 'created'.
|
||||||
**--cpu-period**=*0*
|
**--cpu-period**=*0*
|
||||||
Limit the CPU CFS (Completely Fair Scheduler) period
|
Limit the CPU CFS (Completely Fair Scheduler) period
|
||||||
|
|
||||||
|
Limit the container's CPU usage. This flag tell the kernel to restrict the container's CPU usage to the period you specify.
|
||||||
|
|
||||||
**--cpuset-cpus**=""
|
**--cpuset-cpus**=""
|
||||||
CPUs in which to allow execution (0-3, 0,1)
|
CPUs in which to allow execution (0-3, 0,1)
|
||||||
|
|
||||||
|
@ -136,6 +140,19 @@ two memory nodes.
|
||||||
**--cpu-quota**=*0*
|
**--cpu-quota**=*0*
|
||||||
Limit the CPU CFS (Completely Fair Scheduler) quota
|
Limit the CPU CFS (Completely Fair Scheduler) quota
|
||||||
|
|
||||||
|
**--cpu-rt-period**=0
|
||||||
|
Limit the CPU real-time period in microseconds
|
||||||
|
|
||||||
|
Limit the container's Real Time CPU usage. This flag tell the kernel to restrict the container's Real Time CPU usage to the period you specify.
|
||||||
|
|
||||||
|
**--cpu-rt-runtime**=0
|
||||||
|
Limit the CPU real-time runtime in microseconds
|
||||||
|
|
||||||
|
Limit the containers Real Time CPU usage. This flag tells the kernel to limit the amount of time in a given CPU period Real Time tasks may consume. Ex:
|
||||||
|
Period of 1,000,000us and Runtime of 950,000us means that this container could consume 95% of available CPU and leave the remaining 5% to normal priority tasks.
|
||||||
|
|
||||||
|
The sum of all runtimes across containers cannot exceed the amount alotted to the parent cgroup.
|
||||||
|
|
||||||
**--device**=[]
|
**--device**=[]
|
||||||
Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)
|
Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@ docker-run - Run a command in a new container
|
||||||
[**--cidfile**[=*CIDFILE*]]
|
[**--cidfile**[=*CIDFILE*]]
|
||||||
[**--cpu-period**[=*0*]]
|
[**--cpu-period**[=*0*]]
|
||||||
[**--cpu-quota**[=*0*]]
|
[**--cpu-quota**[=*0*]]
|
||||||
|
[**--cpu-rt-period**[=*0*]]
|
||||||
|
[**--cpu-rt-runtime**[=*0*]]
|
||||||
[**--cpuset-cpus**[=*CPUSET-CPUS*]]
|
[**--cpuset-cpus**[=*CPUSET-CPUS*]]
|
||||||
[**--cpuset-mems**[=*CPUSET-MEMS*]]
|
[**--cpuset-mems**[=*CPUSET-MEMS*]]
|
||||||
[**-d**|**--detach**]
|
[**-d**|**--detach**]
|
||||||
|
@ -192,6 +194,19 @@ two memory nodes.
|
||||||
CPU resource. This flag tell the kernel to restrict the container's CPU usage
|
CPU resource. This flag tell the kernel to restrict the container's CPU usage
|
||||||
to the quota you specify.
|
to the quota you specify.
|
||||||
|
|
||||||
|
**--cpu-rt-period**=0
|
||||||
|
Limit the CPU real-time period in microseconds
|
||||||
|
|
||||||
|
Limit the container's Real Time CPU usage. This flag tell the kernel to restrict the container's Real Time CPU usage to the period you specify.
|
||||||
|
|
||||||
|
**--cpu-rt-runtime**=0
|
||||||
|
Limit the CPU real-time runtime in microseconds
|
||||||
|
|
||||||
|
Limit the containers Real Time CPU usage. This flag tells the kernel to limit the amount of time in a given CPU period Real Time tasks may consume. Ex:
|
||||||
|
Period of 1,000,000us and Runtime of 950,000us means that this container could consume 95% of available CPU and leave the remaining 5% to normal priority tasks.
|
||||||
|
|
||||||
|
The sum of all runtimes across containers cannot exceed the amount alotted to the parent cgroup.
|
||||||
|
|
||||||
**-d**, **--detach**=*true*|*false*
|
**-d**, **--detach**=*true*|*false*
|
||||||
Detached mode: run the container in the background and print the new container ID. The default is *false*.
|
Detached mode: run the container in the background and print the new container ID. The default is *false*.
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ docker-update - Update configuration of one or more containers
|
||||||
[**--cpu-shares**[=*0*]]
|
[**--cpu-shares**[=*0*]]
|
||||||
[**--cpu-period**[=*0*]]
|
[**--cpu-period**[=*0*]]
|
||||||
[**--cpu-quota**[=*0*]]
|
[**--cpu-quota**[=*0*]]
|
||||||
|
[**--cpu-rt-period**[=*0*]]
|
||||||
|
[**--cpu-rt-runtime**[=*0*]]
|
||||||
[**--cpuset-cpus**[=*CPUSET-CPUS*]]
|
[**--cpuset-cpus**[=*CPUSET-CPUS*]]
|
||||||
[**--cpuset-mems**[=*CPUSET-MEMS*]]
|
[**--cpuset-mems**[=*CPUSET-MEMS*]]
|
||||||
[**--help**]
|
[**--help**]
|
||||||
|
@ -44,9 +46,24 @@ a running container with kernel memory initialized.
|
||||||
**--cpu-period**=0
|
**--cpu-period**=0
|
||||||
Limit the CPU CFS (Completely Fair Scheduler) period
|
Limit the CPU CFS (Completely Fair Scheduler) period
|
||||||
|
|
||||||
|
Limit the container's CPU usage. This flag tell the kernel to restrict the container's CPU usage to the period you specify.
|
||||||
|
|
||||||
**--cpu-quota**=0
|
**--cpu-quota**=0
|
||||||
Limit the CPU CFS (Completely Fair Scheduler) quota
|
Limit the CPU CFS (Completely Fair Scheduler) quota
|
||||||
|
|
||||||
|
**--cpu-rt-period**=0
|
||||||
|
Limit the CPU real-time period in microseconds
|
||||||
|
|
||||||
|
Limit the container's Real Time CPU usage. This flag tell the kernel to restrict the container's Real Time CPU usage to the period you specify.
|
||||||
|
|
||||||
|
**--cpu-rt-runtime**=0
|
||||||
|
Limit the CPU real-time runtime in microseconds
|
||||||
|
|
||||||
|
Limit the containers Real Time CPU usage. This flag tells the kernel to limit the amount of time in a given CPU period Real Time tasks may consume. Ex:
|
||||||
|
Period of 1,000,000us and Runtime of 950,000us means that this container could consume 95% of available CPU and leave the remaining 5% to normal priority tasks.
|
||||||
|
|
||||||
|
The sum of all runtimes across containers cannot exceed the amount alotted to the parent cgroup.
|
||||||
|
|
||||||
**--cpuset-cpus**=""
|
**--cpuset-cpus**=""
|
||||||
CPUs in which to allow execution (0-3, 0,1)
|
CPUs in which to allow execution (0-3, 0,1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue