mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
Allow update rt_period_us and rt_runtime_us
Currently runc already supports setting realtime runtime and period before container processes start, this commit will add update support for realtime scheduler resources. Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
@@ -40,6 +40,8 @@ The accepted format is as follow (unchanged values can be omitted):
|
||||
"shares": 0,
|
||||
"quota": 0,
|
||||
"period": 0,
|
||||
"realtimeRuntime": 0,
|
||||
"realtimePeriod": 0,
|
||||
"cpus": "",
|
||||
"mems": ""
|
||||
},
|
||||
@@ -59,16 +61,24 @@ other options are ignored.
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "cpu-period",
|
||||
Usage: "CPU period to be used for hardcapping (in usecs). 0 to use system default",
|
||||
Usage: "CPU CFS period to be used for hardcapping (in usecs). 0 to use system default",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "cpu-quota",
|
||||
Usage: "CPU hardcap limit (in usecs). Allowed cpu time in a given period",
|
||||
Usage: "CPU CFS hardcap limit (in usecs). Allowed cpu time in a given period",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "cpu-share",
|
||||
Usage: "CPU shares (relative weight vs. other containers)",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "cpu-rt-period",
|
||||
Usage: "CPU realtime period to be used for hardcapping (in usecs). 0 to use system default",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "cpu-rt-runtime",
|
||||
Usage: "CPU realtime hardcap limit (in usecs). Allowed cpu time in a given period",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "cpuset-cpus",
|
||||
Usage: "CPU(s) to use",
|
||||
@@ -113,11 +123,13 @@ other options are ignored.
|
||||
KernelTCP: u64Ptr(0),
|
||||
},
|
||||
CPU: &specs.CPU{
|
||||
Shares: u64Ptr(0),
|
||||
Quota: u64Ptr(0),
|
||||
Period: u64Ptr(0),
|
||||
Cpus: sPtr(""),
|
||||
Mems: sPtr(""),
|
||||
Shares: u64Ptr(0),
|
||||
Quota: u64Ptr(0),
|
||||
Period: u64Ptr(0),
|
||||
RealtimeRuntime: u64Ptr(0),
|
||||
RealtimePeriod: u64Ptr(0),
|
||||
Cpus: sPtr(""),
|
||||
Mems: sPtr(""),
|
||||
},
|
||||
BlockIO: &specs.BlockIO{
|
||||
Weight: u16Ptr(0),
|
||||
@@ -162,6 +174,8 @@ other options are ignored.
|
||||
|
||||
{"cpu-period", r.CPU.Period},
|
||||
{"cpu-quota", r.CPU.Quota},
|
||||
{"cpu-rt-period", r.CPU.RealtimePeriod},
|
||||
{"cpu-rt-runtime", r.CPU.RealtimeRuntime},
|
||||
{"cpu-share", r.CPU.Shares},
|
||||
} {
|
||||
if val := context.String(pair.opt); val != "" {
|
||||
@@ -197,6 +211,8 @@ other options are ignored.
|
||||
config.Cgroups.Resources.CpuPeriod = int64(*r.CPU.Period)
|
||||
config.Cgroups.Resources.CpuQuota = int64(*r.CPU.Quota)
|
||||
config.Cgroups.Resources.CpuShares = int64(*r.CPU.Shares)
|
||||
config.Cgroups.Resources.CpuRtPeriod = int64(*r.CPU.RealtimePeriod)
|
||||
config.Cgroups.Resources.CpuRtRuntime = int64(*r.CPU.RealtimeRuntime)
|
||||
config.Cgroups.Resources.CpusetCpus = *r.CPU.Cpus
|
||||
config.Cgroups.Resources.CpusetMems = *r.CPU.Mems
|
||||
config.Cgroups.Resources.KernelMemory = int64(*r.Memory.Kernel)
|
||||
|
||||
Reference in New Issue
Block a user