Skip to content

Commit 6ad2da9

Browse files
committed
fix cpu.cfs_quota_us changed when systemd daemon-reload using systemd.
Signed-off-by: xuxinkun <[email protected]>
1 parent 02141ce commit 6ad2da9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libcontainer/cgroups/systemd/apply_systemd.go

+7
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ func (m *Manager) Apply(pid int) error {
269269
newProp("CPUShares", uint64(c.Resources.CpuShares)))
270270
}
271271

272+
// cpu.cfs_quota_us and cpu.cfs_period_us are controlled by systemd.
273+
if c.Resources.CpuQuota != 0 && c.Resources.CpuPeriod != 0 {
274+
cpuQuotaPerSecUSec := c.Resources.CpuQuota * 1000000 / c.Resources.CpuPeriod
275+
properties = append(properties,
276+
newProp("CPUQuotaPerSecUSec", uint64(cpuQuotaPerSecUSec)))
277+
}
278+
272279
if c.Resources.BlkioWeight != 0 {
273280
properties = append(properties,
274281
newProp("BlockIOWeight", uint64(c.Resources.BlkioWeight)))

0 commit comments

Comments
 (0)