diff --git a/pkg/cgroups/cgroups_linux_test.go b/pkg/cgroups/cgroups_linux_test.go index b218b7007..fa6ee158e 100644 --- a/pkg/cgroups/cgroups_linux_test.go +++ b/pkg/cgroups/cgroups_linux_test.go @@ -45,6 +45,9 @@ func TestResources(t *testing.T) { var resources configs.Resources resources.CpuPeriod = 100000 resources.CpuQuota = 100000 + resources.CpuShares = 100 + resources.CpusetCpus = "0-5" + resources.CpusetMems = "0" resources.Memory = 900 resources.MemorySwap = 1000 resources.BlkioWeight = 300 diff --git a/pkg/cgroups/systemd_linux.go b/pkg/cgroups/systemd_linux.go index ee9f584de..97128a954 100644 --- a/pkg/cgroups/systemd_linux.go +++ b/pkg/cgroups/systemd_linux.go @@ -140,6 +140,10 @@ func resourcesToProps(res *configs.Resources) (map[string]uint64, map[string]str uMap["CPUQuotaPerSecUSec"] = cpuQuotaPerSecUSec } + if res.CpuShares != 0 { + uMap["CPUWeight"] = res.CpuShares + } + // CPUSet if res.CpusetCpus != "" { bits := []byte(res.CpusetCpus)