Skip to content

Commit 49a33c4

Browse files
authoredMar 6, 2017
Merge pull request #1344 from xuxinkun/fixCPUQuota20170224
fix cpu.cfs_quota_us changed when systemd daemon-reload using systemd.
2 parents 291bf60 + c44aec9 commit 49a33c4

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)
Please sign in to comment.