summaryrefslogtreecommitdiffstats
path: root/src/core/cgroup.c
diff options
context:
space:
mode:
authorChris Down <chris@chrisdown.name>2018-12-12 11:49:35 +0100
committerLennart Poettering <lennart@poettering.net>2018-12-12 20:50:10 +0100
commitcb5e3bc37d5eeb9e85d8b4bdbf6cce0640a448d6 (patch)
tree50dad7d7265d7baed213e7769255ac07fce491bf /src/core/cgroup.c
parenttimedated: Add dbus method to retrieve list of time zones (#11114) (diff)
downloadsystemd-cb5e3bc37d5eeb9e85d8b4bdbf6cce0640a448d6.tar.xz
systemd-cb5e3bc37d5eeb9e85d8b4bdbf6cce0640a448d6.zip
cgroup: Don't explicitly check for member in UNIT_BEFORE
The parent slice is always filtered ahead of time from UNIT_BEFORE, so checking if the current member is the same as the parent unit will never pass. I may also write a SLICE_FOREACH_CHILD macro to remove some more of the parent slice checks, but this requires a bit of a rework and general refactoring and may not be worth it, so let's just do this for now.
Diffstat (limited to '')
-rw-r--r--src/core/cgroup.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 5590047976..12f9924c17 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -1367,14 +1367,8 @@ CGroupMask unit_get_members_mask(Unit *u) {
Iterator i;
HASHMAP_FOREACH_KEY(v, member, u->dependencies[UNIT_BEFORE], i) {
-
- if (member == u)
- continue;
-
- if (UNIT_DEREF(member->slice) != u)
- continue;
-
- u->cgroup_members_mask |= unit_get_subtree_mask(member); /* note that this calls ourselves again, for the children */
+ if (UNIT_DEREF(member->slice) == u)
+ u->cgroup_members_mask |= unit_get_subtree_mask(member); /* note that this calls ourselves again, for the children */
}
}
@@ -2120,9 +2114,6 @@ static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) {
void *v;
HASHMAP_FOREACH_KEY(v, m, u->dependencies[UNIT_BEFORE], i) {
- if (m == u)
- continue;
-
/* Skip units that have a dependency on the slice
* but aren't actually in it. */
if (UNIT_DEREF(m->slice) != slice)
@@ -3034,13 +3025,8 @@ void unit_invalidate_cgroup_bpf(Unit *u) {
void *v;
HASHMAP_FOREACH_KEY(v, member, u->dependencies[UNIT_BEFORE], i) {
- if (member == u)
- continue;
-
- if (UNIT_DEREF(member->slice) != u)
- continue;
-
- unit_invalidate_cgroup_bpf(member);
+ if (UNIT_DEREF(member->slice) == u)
+ unit_invalidate_cgroup_bpf(member);
}
}
}