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.
This commit is contained in:
parent
2cf0b2fe2d
commit
cb5e3bc37d
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue