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
4c4545c92f
commit
4f320d7c2a
|
@ -18,6 +18,8 @@ type updateOptions struct {
|
|||
blkioWeight uint16
|
||||
cpuPeriod int64
|
||||
cpuQuota int64
|
||||
cpuRealtimePeriod int64
|
||||
cpuRealtimeRuntime int64
|
||||
cpusetCpus string
|
||||
cpusetMems string
|
||||
cpuShares int64
|
||||
|
@ -51,6 +53,8 @@ func NewUpdateCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|||
flags.Uint16Var(&opts.blkioWeight, "blkio-weight", 0, "Block IO (relative weight), between 10 and 1000")
|
||||
flags.Int64Var(&opts.cpuPeriod, "cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period")
|
||||
flags.Int64Var(&opts.cpuQuota, "cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota")
|
||||
flags.Int64Var(&opts.cpuRealtimePeriod, "cpu-rt-period", 0, "Limit the CPU real-time period in microseconds")
|
||||
flags.Int64Var(&opts.cpuRealtimeRuntime, "cpu-rt-runtime", 0, "Limit the CPU real-time runtime in microseconds")
|
||||
flags.StringVar(&opts.cpusetCpus, "cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)")
|
||||
flags.StringVar(&opts.cpusetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)")
|
||||
flags.Int64VarP(&opts.cpuShares, "cpu-shares", "c", 0, "CPU shares (relative weight)")
|
||||
|
@ -125,6 +129,8 @@ func runUpdate(dockerCli *command.DockerCli, opts *updateOptions) error {
|
|||
KernelMemory: kernelMemory,
|
||||
CPUPeriod: opts.cpuPeriod,
|
||||
CPUQuota: opts.cpuQuota,
|
||||
CPURealtimePeriod: opts.cpuRealtimePeriod,
|
||||
CPURealtimeRuntime: opts.cpuRealtimeRuntime,
|
||||
}
|
||||
|
||||
updateConfig := containertypes.UpdateConfig{
|
||||
|
|
Loading…
Reference in New Issue