Skip to content

Commit

Permalink
fix cpu.cfs_quota_us changed when systemd daemon-reload using systemd.
Browse files Browse the repository at this point in the history
Signed-off-by: xuxinkun <xuxinkun@gmail.com>
  • Loading branch information
xuxinkun authored and runcom committed Sep 21, 2017
1 parent 31a9f6e commit c5d3116
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libcontainer/cgroups/systemd/apply_systemd.go
Expand Up @@ -141,6 +141,13 @@ func (m *Manager) Apply(pid int) error {
newProp("CPUShares", uint64(c.Resources.CpuShares)))
}

// cpu.cfs_quota_us and cpu.cfs_period_us are controlled by systemd.
if c.Resources.CpuQuota != 0 && c.Resources.CpuPeriod != 0 {
cpuQuotaPerSecUSec := c.Resources.CpuQuota * 1000000 / c.Resources.CpuPeriod
properties = append(properties,
newProp("CPUQuotaPerSecUSec", uint64(cpuQuotaPerSecUSec)))
}

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

0 comments on commit c5d3116

Please sign in to comment.