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

cgroups/cgfsng: improve swap accounting support detection #663

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

mihalicyn
Copy link
Member

When LXCFS daemon runs in a root cgroup of cgroup2 tree, we need to go down the tree when checking for memory.swap.current.

We already have some logic to go up the tree from LXCFS daemon's cgroup, but it's useless when LXCFS daemon sits in the cgroup2 tree root.

When LXCFS daemon runs in a root cgroup of cgroup2 tree,
we need to go down the tree when checking for memory.swap.current.

We already have some logic to go up the tree from LXCFS daemon's
cgroup, but it's useless when LXCFS daemon sits in the cgroup2 tree root.

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
@mihalicyn
Copy link
Member Author

Just for reference, these days it not possible to disable swap accounting on memcg:
torvalds/linux@b25806d

@mihalicyn
Copy link
Member Author

cc @alexhudspith

Copy link
Member

@brauner brauner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't handle the case where no cgroup exists in /sys/fs/cgroup/ at all but that's extremely unlikely so I'm not sure it's worth worrying about.

@brauner brauner merged commit 2ace0bc into lxc:main Oct 2, 2024
13 checks passed
mihalicyn added a commit to mihalicyn/lxd-ci that referenced this pull request Oct 2, 2024
Older LXCFS versions (4.0.x and 5.0.x branches) do not handle
swap accounting on cgroup2 properly. While we are improving cgroup2
tests for a newer LXD versions we don't want to make tests red on
the older ones. So, let's check if LXCFS declares support for
swap accounting and only in this case make any checks for it.

See also:
lxc/lxcfs#663

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
mihalicyn added a commit to mihalicyn/lxd-ci that referenced this pull request Oct 2, 2024
Older LXCFS versions (4.0.x and 5.0.x branches) do not handle
swap accounting on cgroup2 properly. While we are improving cgroup2
tests for a newer LXD versions we don't want to make tests red on
the older ones. So, let's check if LXCFS declares support for
swap accounting and only in this case make any checks for it.

See also:
lxc/lxcfs#663

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
mihalicyn added a commit to mihalicyn/lxd-ci that referenced this pull request Oct 2, 2024
Older LXCFS versions (4.0.x and 5.0.x branches) do not handle
swap accounting on cgroup2 properly. While we are improving cgroup2
tests for a newer LXD versions we don't want to make tests red on
the older ones. So, let's check if LXCFS declares support for
swap accounting and only in this case make any checks for it.

See also:
lxc/lxcfs#663

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
hamistao pushed a commit to hamistao/lxd-ci that referenced this pull request Oct 10, 2024
Older LXCFS versions (4.0.x and 5.0.x branches) do not handle
swap accounting on cgroup2 properly. While we are improving cgroup2
tests for a newer LXD versions we don't want to make tests red on
the older ones. So, let's check if LXCFS declares support for
swap accounting and only in this case make any checks for it.

See also:
lxc/lxcfs#663

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants