summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-11-24 19:51:36 +0100
committerSven Eden <yamakuzure@gmx.net>2017-11-24 19:51:36 +0100
commit3323d919b6e2f09e33f63fd44ead2c370be285c8 (patch)
treebc3ad7bee4be8474c4356d50c1246fb3ed6d60f6 /src
parentaf8a841fa32a6db5eb584309184fcd73422d4faf (diff)
unit: initialize bpf cgroup realization state properly
Before this patch, the bpf cgroup realization state was implicitly set to "NO", meaning that the bpf configuration was realized but was turned off. That means invalidation requests for the bpf stuff (which we issue in blanket fashion when doing a daemon reload) would actually later result in a us re-realizing the unit, under the assumption it was already realized once, even though in reality it never was realized before. This had the effect that after each daemon-reload we'd end up realizing *all* defined units, even the unloaded ones, populating cgroupfs with lots of unneeded empty cgroups. With this fix we properly set the realiazation state to "INVALIDATED", i.e. indicating the bpf stuff was never set up for the unit, and hence when we try to invalidate it later we won't do anything.
Diffstat (limited to 'src')
-rw-r--r--src/core/cgroup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 0db191590..a0371512d 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -2495,7 +2495,7 @@ void unit_invalidate_cgroup(Unit *u, CGroupMask m) {
if (m & (CGROUP_MASK_CPU | CGROUP_MASK_CPUACCT))
m |= CGROUP_MASK_CPU | CGROUP_MASK_CPUACCT;
- if ((u->cgroup_realized_mask & m) == 0)
+ if ((u->cgroup_realized_mask & m) == 0) /* NOP? */
return;
u->cgroup_realized_mask &= ~m;
@@ -2508,7 +2508,7 @@ void unit_invalidate_cgroup_bpf(Unit *u) {
if (!UNIT_HAS_CGROUP_CONTEXT(u))
return;
- if (u->cgroup_bpf_state == UNIT_CGROUP_BPF_INVALIDATED)
+ if (u->cgroup_bpf_state == UNIT_CGROUP_BPF_INVALIDATED) /* NOP? */
return;
u->cgroup_bpf_state = UNIT_CGROUP_BPF_INVALIDATED;