Skip to content
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

[1.0] libct/cg/v1: work around CPU quota period set failure #3115

Merged
merged 1 commit into from
Aug 11, 2021

Conversation

kolyshkin
Copy link
Contributor

@kolyshkin kolyshkin commented Jul 28, 2021

This is a partial backport of #3090 (first commit -- the fix itself -- only) to release-1.0 branch. Test case and cleanups are omitted as those are too big and do not add much value to this branch.

As reported in issue #3084, sometimes setting CPU quota period fails
when a new period is lower and a parent cgroup has CPU quota limit set.

This happens as in cgroup v1 the quota and the period can not be set
together (this is fixed in v2), and since the period is being set first,
new_limit = old_quota/new_period may be higher than the parent cgroup
limit.

The fix is to retry setting the period after the quota, to cover all
possible scenarios.

Add a test case to cover a regression caused by an earlier version of
this patch (ignoring a failure of setting invalid period when quota is
not set).

Signed-off-by: Kir Kolyshkin [email protected]
(cherry picked from commit 1b77ebe)
Signed-off-by: Kir Kolyshkin [email protected]

Proposed changelog entry

* Fixed a failure to set CPU quota period in some cases on cgroup v1 (#3115)

As reported in issue 3084, sometimes setting CPU quota period fails
when a new period is lower and a parent cgroup has CPU quota limit set.

This happens as in cgroup v1 the quota and the period can not be set
together (this is fixed in v2), and since the period is being set first,
new_limit = old_quota/new_period may be higher than the parent cgroup
limit.

The fix is to retry setting the period after the quota, to cover all
possible scenarios.

Add a test case to cover a regression caused by an earlier version of
this patch (ignoring a failure of setting invalid period when quota is
not set).

Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit 1b77ebe)
Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin kolyshkin changed the title libct/cg/v1: workaround CPU quota period set failure [1.0] libct/cg/v1: work around CPU quota period set failure Jul 28, 2021
@kolyshkin kolyshkin added backport/1.0-todo A PR in main branch which needs to be backported to release-1.0 kind/bug area/cgroupv1 labels Jul 28, 2021
@kolyshkin kolyshkin added this to the 1.0.2 milestone Jul 29, 2021
@kolyshkin kolyshkin added backport/1.0-pr A backport PR to release-1.0 and removed backport/1.0-todo A PR in main branch which needs to be backported to release-1.0 labels Aug 2, 2021
@mrunalp mrunalp merged commit 4f08893 into opencontainers:release-1.0 Aug 11, 2021
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.

3 participants