]> git.ipfire.org Git - thirdparty/systemd.git/commit
cgroup: Swap cgroup v1 deletion and migration
authorMichal Koutný <mkoutny@suse.com>
Fri, 1 May 2020 12:00:42 +0000 (14:00 +0200)
committerMichal Koutný <mkoutny@suse.com>
Wed, 19 Aug 2020 09:41:53 +0000 (11:41 +0200)
commit7b63961415920b30a4e9f6d4c87bda20a1d8ec67
treee7937a95935ec2f8972694190de64002f29ebc02
parent30ad3ca0865ba18d3b88da1558cc4ddfeb9701b5
cgroup: Swap cgroup v1 deletion and migration

When we are about to derealize a controller on v1 cgroup, we first
attempt to delete the controller cgroup and migrate afterwards. This
doesn't work in practice because populated cgroup cannot be deleted.
Furthermore, we leave out slices from migration completely, so
(un)setting a control value on them won't realize their controller
cgroup.

Rework actual realization, unit_create_cgroup() becomes
unit_update_cgroup() and make sure that controller hierarchies are
reduced when given controller cgroup ceased to be needed.

Note that with this we introduce slight deviation between v1 and v2 code
-- when a descendant unit turns off a delegated controller, we attempt
to disable it in ancestor slices. On v2 this may fail (kernel enforced,
because of child cgroups using the controller), on v1 we'll migrate
whole subtree and trim the subhierachy. (Previously, we wouldn't take
away delegated controller, however, derealization was broken anyway.)

Fixes: #14149
src/core/cgroup.c
src/shared/cgroup-setup.c
src/shared/cgroup-setup.h