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

runc update: fix updating swap for cgroup v2 #4357

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Sep 12, 2024

  1. libct/cg: improve ConvertMemorySwapToCgroupV2Value

    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>
    kolyshkin committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    b147e1c View commit details
    Browse the repository at this point in the history
  2. runc update: fix updating swap for cgroup v2

    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>
    kolyshkin committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    707ee6d View commit details
    Browse the repository at this point in the history