mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
support SCHED_IDLE for runc cgroupfs
Signed-off-by: wineway <wangyuweihx@gmail.com>
This commit is contained in:
@@ -48,7 +48,8 @@ The accepted format is as follow (unchanged values can be omitted):
|
||||
"realtimeRuntime": 0,
|
||||
"realtimePeriod": 0,
|
||||
"cpus": "",
|
||||
"mems": ""
|
||||
"mems": "",
|
||||
"idle": 0
|
||||
},
|
||||
"blockIO": {
|
||||
"weight": 0
|
||||
@@ -106,6 +107,10 @@ other options are ignored.
|
||||
Name: "memory",
|
||||
Usage: "Memory limit (in bytes)",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "cpu-idle",
|
||||
Usage: "set cgroup SCHED_IDLE or not, 0: default behavior, 1: SCHED_IDLE",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "memory-reservation",
|
||||
Usage: "Memory reservation or soft_limit (in bytes)",
|
||||
@@ -192,6 +197,13 @@ other options are ignored.
|
||||
if val := context.String("cpuset-mems"); val != "" {
|
||||
r.CPU.Mems = val
|
||||
}
|
||||
if val := context.String("cpu-idle"); val != "" {
|
||||
idle, err := strconv.ParseInt(val, 10, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid value for cpu-idle: %w", err)
|
||||
}
|
||||
r.CPU.Idle = i64Ptr(idle)
|
||||
}
|
||||
|
||||
for _, pair := range []struct {
|
||||
opt string
|
||||
@@ -294,6 +306,7 @@ other options are ignored.
|
||||
config.Cgroups.Resources.CpusetCpus = r.CPU.Cpus
|
||||
config.Cgroups.Resources.CpusetMems = r.CPU.Mems
|
||||
config.Cgroups.Resources.Memory = *r.Memory.Limit
|
||||
config.Cgroups.Resources.CPUIdle = r.CPU.Idle
|
||||
config.Cgroups.Resources.MemoryReservation = *r.Memory.Reservation
|
||||
config.Cgroups.Resources.MemorySwap = *r.Memory.Swap
|
||||
config.Cgroups.Resources.MemoryCheckBeforeUpdate = *r.Memory.CheckBeforeUpdate
|
||||
|
||||
Reference in New Issue
Block a user