summaryrefslogtreecommitdiff
path: root/src/core/cgroup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-11 18:21:53 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-11 18:31:50 +0200
commite7ab4d1ac9f8d99eecd5e2d22eb482a1fb0fbf23 (patch)
tree527c03ee340021bfa54cb554a5d6d81b7720838b /src/core/cgroup.c
parent1afaa7e8d29c0fd70a621d96a59487ab54b157fc (diff)
cgroup: unify how we invalidate cgroup controller settings
Let's make sure that we follow the same codepaths when adjusting a cgroup property via the dbus SetProperty() call, and when we execute the StartupCPUShares= effect.
Diffstat (limited to 'src/core/cgroup.c')
-rw-r--r--src/core/cgroup.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 4999a1e116..7d2a2ba67a 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -1581,6 +1581,32 @@ bool unit_cgroup_delegate(Unit *u) {
return c->delegate;
}
+void unit_invalidate_cgroup(Unit *u, CGroupMask m) {
+ assert(u);
+
+ if (!UNIT_HAS_CGROUP_CONTEXT(u))
+ return;
+
+ if (m == 0)
+ return;
+
+ if ((u->cgroup_realized_mask & m) == 0)
+ return;
+
+ u->cgroup_realized_mask &= ~m;
+ unit_add_to_cgroup_queue(u);
+}
+
+void manager_invalidate_startup_units(Manager *m) {
+ Iterator i;
+ Unit *u;
+
+ assert(m);
+
+ SET_FOREACH(u, m->startup_units, i)
+ unit_invalidate_cgroup(u, CGROUP_MASK_CPU|CGROUP_MASK_BLKIO);
+}
+
static const char* const cgroup_device_policy_table[_CGROUP_DEVICE_POLICY_MAX] = {
[CGROUP_AUTO] = "auto",
[CGROUP_CLOSED] = "closed",