-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
systemd: adjust CPUQuotaPerSecUSec to compensate for systemd internal handling #1651
systemd: adjust CPUQuotaPerSecUSec to compensate for systemd internal handling #1651
Conversation
a02ae6c
to
f4900a8
Compare
This was a fun one. LGTM |
wait on this, my rounding is wrong for quotas that don't need adjustment. i'll fix in a minute. |
f97fc12
to
b9c18b8
Compare
ok should be good now |
@@ -271,6 +271,13 @@ func (m *Manager) Apply(pid int) error { | |||
// cpu.cfs_quota_us and cpu.cfs_period_us are controlled by systemd. | |||
if c.Resources.CpuQuota != 0 && c.Resources.CpuPeriod != 0 { | |||
cpuQuotaPerSecUSec := uint64(c.Resources.CpuQuota*1000000) / c.Resources.CpuPeriod | |||
// systemd converts CPUQuotaPerSecUSec (microseconds per CPU second) to CPUQuota | |||
// (integer percentage of CPU) internally. This means that if a fractional percent of | |||
// CPU is inidicated by Resources.CpuQuota, we need to round up to the nearest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit inidicated to indicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment nit, otherwise LGTM
… handling Signed-off-by: Seth Jennings <sjenning@redhat.com>
b9c18b8
to
bca53e7
Compare
@mrunalp can I get review/approval on this? I need one other approver as well. |
Its a bit ugly though, do you think we should just let systemd create the slice without limits, then set the limits ourselves ? |
@dqminh it is not a good idea to change values in cgroups that systemd thinks it controls. We have encountered issues where things like a daemon-reload will cause those values to be lost. |
LGTM @sjenning yah i think i had some similar bugs like that in the past I thought that would be fixed in recent version of systemd though ( but im not too sure as we dont run systemd cgroup now). Probably need more investigations though, meanwhile i think this works fine as a workaround. |
Automatic merge from submit-queue. UPSTREAM: opencontainer/runc: 1651: systemd: adjust CPUQuotaPerSecUSec to compensate for systemd internal handling opencontainers/runc#1651 holding on master rebase @derekwaynecarr @mrunalp @jupierce
Automatic merge from submit-queue. [3.8] UPSTREAM: opencontainers/runc: 1651: systemd: adjust CPUQuotaPerSecUSec to compensate for systemd internal handling opencontainers/runc#1651 master PR: #17348 @derekwaynecarr @mrunalp @jupierce @eparis @smarterclayton
xref https://bugzilla.redhat.com/show_bug.cgi?id=1509467#c6
@derekwaynecarr @jupierce @mrunalp