summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-05-22 07:06:16 +0900
committerLennart Poettering <lennart@poettering.net>2014-05-22 07:13:56 +0900
commitdb785129c9bce9294a118484cbc9bb6935ca34c2 (patch)
treea1c9508390cffe4eafc0592701ad566bba672b93 /src/core/unit.c
parent95ae05c0e79868c22b3e8e6fbc53432786876730 (diff)
cgroup: rework startup logic
Introduce a (unsigned long) -1 as "unset" state for cpu shares/block io weights, and keep the startup unit set around all the time.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index ea55c709b0..99ee709efd 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -509,6 +509,7 @@ void unit_free(Unit *u) {
}
set_remove(u->manager->failed_units, u);
+ set_remove(u->manager->startup_units, u);
free(u->description);
strv_free(u->documentation);
@@ -1076,12 +1077,17 @@ static int unit_add_startup_units(Unit *u) {
int r = 0;
c = unit_get_cgroup_context(u);
- if (c != NULL && manager_state(u->manager) == MANAGER_STARTING &&
- (c->startup_cpu_shares_set || c->startup_blockio_weight_set)) {
- r = set_put(u->manager->startup_units, u);
- if (r == -EEXIST)
- r = 0;
- }
+ if (!c)
+ return 0;
+
+ if (c->startup_cpu_shares == (unsigned long) -1 &&
+ c->startup_blockio_weight == (unsigned long) -1)
+ return 0;
+
+ r = set_put(u->manager->startup_units, u);
+ if (r == -EEXIST)
+ return 0;
+
return r;
}