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

Fix swap handling for cgroups v2 #617

Merged
merged 3 commits into from
Mar 27, 2024
Merged

Commits on Mar 27, 2024

  1. proc_fuse: Fix get_swap_info typo swtotal == 0 -> *swtotal == 0

    Signed-off-by: Alex Hudspith <[email protected]>
    alexhudspith authored and mihalicyn committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    b50a9a3 View commit details
    Browse the repository at this point in the history
  2. proc: Fix swap handling for cgroups v2 (can_use_swap)

    On cgroups v2, there are no swap current/max files at the cgroup root, so
    can_use_swap must look lower in the hierarchy to determine if swap accounting
    is enabled. To also account for memory accounting being turned off at some
    level, walk the hierarchy upwards from lxcfs' own cgroup.
    
    Signed-off-by: Alex Hudspith <[email protected]>
    [ added check cgroup pointer is not NULL in lxcfs_init() ]
    Signed-off-by: Alexander Mikhalitsyn <[email protected]>
    alexhudspith authored and mihalicyn committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    f496e62 View commit details
    Browse the repository at this point in the history
  3. proc: Fix swap handling for cgroups v2 (zero limits)

    Since memory.swap.max = 0 is valid under v2, limits of 0 must not be
    treated differently. Instead, use UINT64_MAX as the default limit. This aligns
    with cgroups v1 behaviour anyway since 'limit_in_bytes' files contain a large
    number for unspecified limits (2^63).
    
    Resolves: lxc#534
    Signed-off-by: Alex Hudspith <[email protected]>
    alexhudspith authored and mihalicyn committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    a6c309b View commit details
    Browse the repository at this point in the history