summaryrefslogtreecommitdiffstats
path: root/src/core/cgroup.c
diff options
context:
space:
mode:
authorMichal Koutný <mkoutny@suse.com>2020-06-01 17:33:51 +0200
committerMichal Koutný <mkoutny@suse.com>2020-08-19 11:41:53 +0200
commitf23ba94db31feb0ede6524fdabd0efdb8344e90b (patch)
treebd55c797ae82b612ac2f09644e290eedc81d060d /src/core/cgroup.c
parentcgroup: Eager realization in unit_free (diff)
downloadsystemd-f23ba94db31feb0ede6524fdabd0efdb8344e90b.tar.xz
systemd-f23ba94db31feb0ede6524fdabd0efdb8344e90b.zip
cgroup: Implicit unit_invalidate_cgroup_members_masks
Merge members mask invalidation into unit_add_siblings_to_cgroup_realize_queue, this way unit_realize_cgroup needn't be called with members mask invalidation. We have to retain the members mask invalidation in unit_load -- although active units would have cgroups (re)realized (unit_load queues for realization), the realization would happen with potentially stale mask.
Diffstat (limited to 'src/core/cgroup.c')
-rw-r--r--src/core/cgroup.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 84512963a4..c159310748 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -2319,6 +2319,8 @@ void unit_add_siblings_to_cgroup_realize_queue(Unit *u) {
/* This adds the path from the specified unit to root slice to the queue and siblings at each level.
* The unit itself is excluded (assuming it's handled separately).
+ * The function must invalidate cgroup_members_mask of all ancestors in order to calculate up to date
+ * masks.
*
* Propagation of realization "side-ways" (i.e. towards siblings) is relevant on cgroup-v1 where
* scheduling becomes very weird if two units that own processes reside in the same slice, but one is
@@ -2333,6 +2335,9 @@ void unit_add_siblings_to_cgroup_realize_queue(Unit *u) {
Unit *m;
void *v;
+ /* Children of slice likely changed when we're called */
+ slice->cgroup_members_mask_valid = false;
+
HASHMAP_FOREACH_KEY(v, m, slice->dependencies[UNIT_BEFORE], i) {
/* Skip units that have a dependency on the slice but aren't actually in it. */
if (UNIT_DEREF(m->slice) != slice)