Skip to content

Commit

Permalink
Merge pull request #2210 from Zyqsempai/2164-remove-deprecated-system…
Browse files Browse the repository at this point in the history
…d-resources

Exchange deprecated systemd resources with the appropriate for cgroupv2
  • Loading branch information
hqhq authored Feb 29, 2020
2 parents 688cf6d + 5b96f31 commit 3b7e32f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions libcontainer/cgroups/systemd/unified_hierarchy.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,20 @@ func (m *UnifiedManager) Apply(pid int) error {
properties = append(properties,
newProp("MemoryAccounting", true),
newProp("CPUAccounting", true),
newProp("BlockIOAccounting", true))
newProp("IOAccounting", true))

// Assume DefaultDependencies= will always work (the check for it was previously broken.)
properties = append(properties,
newProp("DefaultDependencies", false))

if c.Resources.Memory != 0 {
properties = append(properties,
newProp("MemoryLimit", uint64(c.Resources.Memory)))
newProp("MemoryMax", uint64(c.Resources.Memory)))
}

if c.Resources.CpuShares != 0 {
if c.Resources.CpuWeight != 0 {
properties = append(properties,
newProp("CPUShares", c.Resources.CpuShares))
newProp("CPUWeight", c.Resources.CpuWeight))
}

// cpu.cfs_quota_us and cpu.cfs_period_us are controlled by systemd.
Expand All @@ -117,11 +117,6 @@ func (m *UnifiedManager) Apply(pid int) error {
newProp("CPUQuotaPerSecUSec", cpuQuotaPerSecUSec))
}

if c.Resources.BlkioWeight != 0 {
properties = append(properties,
newProp("BlockIOWeight", uint64(c.Resources.BlkioWeight)))
}

if c.Resources.PidsLimit > 0 {
properties = append(properties,
newProp("TasksAccounting", true),
Expand Down

0 comments on commit 3b7e32f

Please sign in to comment.