cgroup2: add CpuMax conversion

Fix #2243

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2020-03-10 02:20:17 +09:00
parent 64e9a97981
commit aa269315a4
5 changed files with 67 additions and 0 deletions
+3
View File
@@ -492,6 +492,9 @@ func CreateCgroupConfig(opts *CreateOpts) (*configs.Cgroup, error) {
if r.CPU.Period != nil {
c.Resources.CpuPeriod = *r.CPU.Period
}
//CpuMax is used for cgroupv2 and should be converted
c.Resources.CpuMax = cgroups.ConvertCPUQuotaCPUPeriodToCgroupV2Value(c.Resources.CpuQuota, c.Resources.CpuPeriod)
if r.CPU.RealtimeRuntime != nil {
c.Resources.CpuRtRuntime = *r.CPU.RealtimeRuntime
}