X Tutup
Skip to content

Update runc to 9c2d8d184e5da67c95d601382adf14862e4f2228#31736

Merged
vdemeester merged 1 commit intomoby:masterfrom
mlaventure:update-runc
Mar 12, 2017
Merged

Update runc to 9c2d8d184e5da67c95d601382adf14862e4f2228#31736
vdemeester merged 1 commit intomoby:masterfrom
mlaventure:update-runc

Conversation

@mlaventure
Copy link
Contributor

This fix a conflict with systemd daemon-reload (see
opencontainers/runc#1344)

Signed-off-by: Kenfe-Mickael Laventure mickael.laventure@gmail.com

--

Closes #30121

diff --git a/libcontainer/cgroups/systemd/apply_systemd.go b/libcontainer/cgroups/systemd/apply_systemd.go
index fd428f9..7ce066c 100644
--- a/libcontainer/cgroups/systemd/apply_systemd.go
+++ b/libcontainer/cgroups/systemd/apply_systemd.go
@@ -269,6 +269,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)))

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This fix a conflict with systemd daemon-reload (see
opencontainers/runc#1344)

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
@vieux
Copy link
Contributor

vieux commented Mar 10, 2017

rebased.

@mlaventure
Copy link
Contributor Author

Thanks!

@vdemeester vdemeester merged commit 613334e into moby:master Mar 12, 2017
@GordonTheTurtle GordonTheTurtle added this to the 17.04.0 milestone Mar 12, 2017
@mlaventure mlaventure deleted the update-runc branch March 13, 2017 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

when docker use --cpu-quota and systemd daemon-reload, old container's cpu.cfs_quota_us become -1

6 participants

X Tutup