[1.2] runc update: fix updating swap for cgroup v2#4501
Merged
kolyshkin merged 2 commits intoopencontainers:release-1.2from Nov 1, 2024
Merged
[1.2] runc update: fix updating swap for cgroup v2#4501kolyshkin merged 2 commits intoopencontainers:release-1.2from
kolyshkin merged 2 commits intoopencontainers:release-1.2from
Conversation
Improve readability of ConvertMemorySwapToCgroupV2Value by switching from a bunch of if statements to a switch, and adding a comment describing each case. No functional change. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit cb9f3d6) Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This allows to do
runc update $ID --memory=-1 --memory-swap=$VAL
for cgroup v2, i.e. set memory to unlimited and swap to a specific
value.
This was not possible because ConvertMemorySwapToCgroupV2Value rejected
memory=-1 ("unlimited"). In a hindsight, it was a mistake, because if
memory limit is unlimited, we should treat memory+swap limit as just swap
limit.
Revise the unit test; add description to each case.
Fixes: c86be8a ("cgroupv2: fix setting MemorySwap")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 732806e)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Merged
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.
Cherry-pick (clean):