summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-11 16:48:24 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-11 18:31:49 +0200
commitd53d94743c5e5e3a4a668b0c707826a90a08949a (patch)
treec9f88941f6a5f072263ee7707500d577bf077300 /src/core/unit.c
parentafc966e288b5013de55c56b18ddc9a5723b865d5 (diff)
core: refactor cpu shares/blockio weight cgroup logic
Let's stop using the "unsigned long" type for weights/shares, and let's just use uint64_t for this, as that's what we expose on the bus. Unify parsers, and always validate the range for these fields. Correct the default blockio weight to 500, since that's what the kernel actually uses. When parsing the weight/shares settings from unit files accept the empty string as a way to reset the weight/shares value. When getting it via the bus, uniformly map (uint64_t) -1 to unset. Open up StartupCPUShares= and StartupBlockIOWeight= to transient units.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 2ebfb09a7a..f12d1c95cb 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1177,8 +1177,8 @@ static int unit_add_startup_units(Unit *u) {
if (!c)
return 0;
- if (c->startup_cpu_shares == (unsigned long) -1 &&
- c->startup_blockio_weight == (unsigned long) -1)
+ if (c->startup_cpu_shares == CGROUP_CPU_SHARES_INVALID &&
+ c->startup_blockio_weight == CGROUP_BLKIO_WEIGHT_INVALID)
return 0;
return set_put(u->manager->startup_units, u);