add cpu.cfs_period_us support

Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
master
Ma Shimiao 2015-04-08 16:58:59 +08:00 committed by Tibor Vass
parent 9949905359
commit edbbcc6dae
3 changed files with 18 additions and 0 deletions

View File

@ -778,6 +778,7 @@ _docker_run() {
--cidfile --cidfile
--cpuset --cpuset
--cpu-shares -c --cpu-shares -c
--cpu-period
--cpu-quota --cpu-quota
--device --device
--dns --dns

View File

@ -950,6 +950,7 @@ Creates a new container.
--cidfile="" Write the container ID to the file --cidfile="" Write the container ID to the file
--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) --cpuset-mems="" Memory nodes (MEMs) in which to allow execution (0-3, 0,1)
--cpu-period=0 Limit the CPU CFS (Completely Fair Scheduler) period
--cpu-quota=0 Limit the CPU CFS (Completely Fair Scheduler) quota --cpu-quota=0 Limit the CPU CFS (Completely Fair Scheduler) quota
--device=[] Add a host device to the container --device=[] Add a host device to the container
--dns=[] Set custom DNS servers --dns=[] Set custom DNS servers
@ -1907,6 +1908,7 @@ To remove an image using its digest:
--cidfile="" Write the container ID to the file --cidfile="" Write the container ID to the file
--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) --cpuset-mems="" Memory nodes (MEMs) in which to allow execution (0-3, 0,1)
--cpu-period=0 Limit the CPU CFS (Completely Fair Scheduler) period
--cpu-quota=0 Limit the CPU CFS (Completely Fair Scheduler) quota --cpu-quota=0 Limit the CPU CFS (Completely Fair Scheduler) quota
-d, --detach=false Run container in background and print container ID -d, --detach=false Run container in background and print container ID
--device=[] Add a host device to the container --device=[] Add a host device to the container

View File

@ -483,6 +483,7 @@ container:
-m, --memory="": Memory limit (format: <number><optional unit>, where unit = b, k, m or g) -m, --memory="": Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
-memory-swap="": Total memory limit (memory + swap, format: <number><optional unit>, where unit = b, k, m or g) -memory-swap="": Total memory limit (memory + swap, format: <number><optional unit>, where unit = b, k, m or g)
-c, --cpu-shares=0: CPU shares (relative weight) -c, --cpu-shares=0: CPU shares (relative weight)
--cpu-period=0: Limit the CPU CFS (Completely Fair Scheduler) period
--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
@ -620,6 +621,20 @@ division of CPU shares:
101 {C1} 1 100% of CPU1 101 {C1} 1 100% of CPU1
102 {C1} 2 100% of CPU2 102 {C1} 2 100% of CPU2
### CPU period constraint
The default CPU CFS (Completely Fair Scheduler) period is 100ms. We can use
`--cpu-period` to set the period of CPUs to limit the container's CPU usage.
And usually `--cpu-period` should work with `--cpu-quota`.
Examples:
$ docker run -ti --cpu-period=50000 --cpu-quota=25000 ubuntu:14.04 /bin/bash
If there is 1 CPU, this means the container can get 50% CPU worth of run-time every 50ms.
For more information, see the [CFS documentation on bandwidth limiting](https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt).
### Cpuset constraint ### Cpuset constraint
We can set cpus in which to allow execution for containers. We can set cpus in which to allow execution for containers.