set cpu.rt_period_us and cpu.rt_runtime_us in the appropriate order#4235
Closed
ls-ggg wants to merge 1 commit intoopencontainers:mainfrom
Closed
set cpu.rt_period_us and cpu.rt_runtime_us in the appropriate order#4235ls-ggg wants to merge 1 commit intoopencontainers:mainfrom
ls-ggg wants to merge 1 commit intoopencontainers:mainfrom
Conversation
e5c7a60 to
e785c44
Compare
Contributor
|
This code is quite complicated. Can you please do something similar to commit 1b2adcf (and add a test case, too)? |
4a16e8b to
28268ee
Compare
Contributor
Author
|
c8a27c4 to
190d5dc
Compare
Contributor
Author
|
rebase |
Contributor
Author
|
@kolyshkin Can this PR be approved? |
lifubang
requested changes
Apr 12, 2024
1c22922 to
c4d13e3
Compare
kolyshkin
reviewed
Apr 24, 2024
As reported in issue opencontainers#4094, sometimes setting rt_period_us and rt_runtime_us at the same time will fail. The reason is that in cgroupv1, these two values cannot be set atomically. When we set a new rt_period_us, the kernel will determine whether the current configuration of new_limit1 = old_quota/new_period exceeds the limit. If it exceeds the limit, an error will be reported. Maybe it is reasonable to set rt_runtime_us first so that the new_limit2 = new_quota/old_period. for example: The original state of cgv1 is rt_period_us: 10000 rt_runtime_us: 5000 The user wants to change it to rt_period_us: 1000 rt_runtime_us:300. The new rt_runtime_us should be set first. In the opposite case, if rt_runtime_us is set first, new_limit2 may still exceed the limit, but new_limit1 will be valid. for example: The original state of cgv1 is rt_period_us: 1000 rt_runtime_us: 500 The user wants to change it to rt_period_us: 10000 rt_runtime_us:3000. The new rt_period_us should be set first. Therefore, new_limit1 and new_limit2 should be calculated in advance, and the smaller corresponding setting order should be selected to set rt_period_us and rt_runtime_us. Signed-off-by: ls-ggg <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: #4094
when users set or update cpu.rt_period_us and cpu.rt_runtime_us at the same time,
runc should set these two values in the appropriate order to ensure that the intermediate value of cpu.rt_runtime_us/cpu.rt_period_us is less than the limit ratio