]> git.proxmox.com Git - mirror_lxcfs.git/commit
proc: Fix swap handling for cgroups v2 (can_use_swap)
authorAlex Hudspith <alex@hudspith.io>
Mon, 6 Nov 2023 09:17:38 +0000 (09:17 +0000)
committerAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Wed, 27 Mar 2024 12:38:32 +0000 (13:38 +0100)
commitf496e62cdbeb01215af34fed266fc5a98d25feeb
tree794de93045736cd836408bd9e5b5f4ecce5da15e
parentb50a9a3d676bf20e62c8b0b23c2c1e7aa69d84b0
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 <alex@hudspith.io>
[ added check cgroup pointer is not NULL in lxcfs_init() ]
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
src/bindings.c
src/cgroups/cgfsng.c
src/cgroups/cgroup.h
src/proc_fuse.c