From: David Strauss <da...@davidstrauss.net> --- src/core/cgroup.c | 20 +++++++++++++++++++- src/core/cgroup.h | 2 ++ src/core/unit.c | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 6a6c504..b75ab55 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -345,6 +345,14 @@ static CGroupControllerMask unit_get_cgroup_mask(Unit *u) { return cgroup_context_get_mask(c); } +void unit_update_parent_slice_mask(Unit *u) { + if (UNIT_ISSET(u->slice)) { + UNIT_DEREF(u->slice)->cgroup_mask |= unit_get_cgroup_mask(u); + log_warning("Setting slice to mask: %x", unit_get_cgroup_mask(u)); + } + log_warning("No slice to update."); +} + static CGroupControllerMask unit_get_members_mask(Unit *u) { CGroupControllerMask mask = 0; Unit *m; @@ -425,12 +433,22 @@ static int unit_realize_cgroup_now(Unit *u) { assert(u); + log_warning("unit_realize_cgroup_now"); + if (u->in_cgroup_queue) { LIST_REMOVE(cgroup_queue, u->manager->cgroup_queue, u); u->in_cgroup_queue = false; } - mask = unit_get_cgroup_mask(u) | unit_get_members_mask(u) | unit_get_siblings_mask(u); + /* If the unit is a member of a slice, the slice will contain + * aggregated cgroup mask data for the unit and all siblings. */ + if (UNIT_ISSET(u->slice)) { + mask = UNIT_DEREF(u->slice)->cgroup_mask; + log_warning("Using cgroup_mask."); + } else { + mask = unit_get_cgroup_mask(u) | unit_get_members_mask(u) | unit_get_siblings_mask(u); + log_warning("Not using cgroup_mask."); + } mask &= u->manager->cgroup_supported; if (u->cgroup_realized && diff --git a/src/core/cgroup.h b/src/core/cgroup.h index 0a079e9..1a24d07 100644 --- a/src/core/cgroup.h +++ b/src/core/cgroup.h @@ -113,3 +113,5 @@ int manager_notify_cgroup_empty(Manager *m, const char *group); const char* cgroup_device_policy_to_string(CGroupDevicePolicy i) _const_; CGroupDevicePolicy cgroup_device_policy_from_string(const char *s) _pure_; + +void unit_update_parent_slice_mask(Unit *u); diff --git a/src/core/unit.c b/src/core/unit.c index e19d281..a018dad 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -981,6 +981,8 @@ int unit_load(Unit *u) { goto fail; } + unit_update_parent_slice_mask(u); + r = unit_add_mount_links(u); if (r < 0) goto fail; -- 1.8.3.1 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel