diff options
author | Michal Koutný <mkoutny@suse.com> | 2020-05-01 14:00:42 +0200 |
---|---|---|
committer | Michal Koutný <mkoutny@suse.com> | 2020-08-19 11:41:53 +0200 |
commit | 7b63961415920b30a4e9f6d4c87bda20a1d8ec67 (patch) | |
tree | e7937a95935ec2f8972694190de64002f29ebc02 /src/shared/cgroup-setup.h | |
parent | cgroup: Add root slice to cgroup realization queue (diff) | |
download | systemd-7b63961415920b30a4e9f6d4c87bda20a1d8ec67.tar.xz systemd-7b63961415920b30a4e9f6d4c87bda20a1d8ec67.zip |
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
Diffstat (limited to 'src/shared/cgroup-setup.h')
-rw-r--r-- | src/shared/cgroup-setup.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shared/cgroup-setup.h b/src/shared/cgroup-setup.h index 6e9b6857d8..72c2b6ee6a 100644 --- a/src/shared/cgroup-setup.h +++ b/src/shared/cgroup-setup.h @@ -29,6 +29,7 @@ int cg_migrate_recursive_fallback(const char *cfrom, const char *pfrom, const ch int cg_create_everywhere(CGroupMask supported, CGroupMask mask, const char *path); int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t callback, void *userdata); int cg_attach_many_everywhere(CGroupMask supported, const char *path, Set* pids, cg_migrate_callback_t callback, void *userdata); -int cg_migrate_everywhere(CGroupMask supported, const char *from, const char *to, cg_migrate_callback_t callback, void *userdata); +int cg_migrate_v1_controllers(CGroupMask supported, CGroupMask mask, const char *from, cg_migrate_callback_t to_callback, void *userdata); int cg_trim_everywhere(CGroupMask supported, const char *path, bool delete_root); +int cg_trim_v1_controllers(CGroupMask supported, CGroupMask mask, const char *path, bool delete_root); int cg_enable_everywhere(CGroupMask supported, CGroupMask mask, const char *p, CGroupMask *ret_result_mask); |