summaryrefslogtreecommitdiff
path: root/src/core/cgroup.h
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/cgroup.h
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/cgroup.h')
-rw-r--r--src/core/cgroup.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/cgroup.h b/src/core/cgroup.h
index 3ba09d56a4..3d455d93ed 100644
--- a/src/core/cgroup.h
+++ b/src/core/cgroup.h
@@ -58,7 +58,7 @@ struct CGroupDeviceAllow {
struct CGroupBlockIODeviceWeight {
LIST_FIELDS(CGroupBlockIODeviceWeight, device_weights);
char *path;
- unsigned long weight;
+ uint64_t weight;
};
struct CGroupBlockIODeviceBandwidth {
@@ -74,12 +74,12 @@ struct CGroupContext {
bool memory_accounting;
bool tasks_accounting;
- unsigned long cpu_shares;
- unsigned long startup_cpu_shares;
+ uint64_t cpu_shares;
+ uint64_t startup_cpu_shares;
usec_t cpu_quota_per_sec_usec;
- unsigned long blockio_weight;
- unsigned long startup_blockio_weight;
+ uint64_t blockio_weight;
+ uint64_t startup_blockio_weight;
LIST_HEAD(CGroupBlockIODeviceWeight, blockio_device_weights);
LIST_HEAD(CGroupBlockIODeviceBandwidth, blockio_device_bandwidths);
@@ -88,9 +88,9 @@ struct CGroupContext {
CGroupDevicePolicy device_policy;
LIST_HEAD(CGroupDeviceAllow, device_allow);
- bool delegate;
-
uint64_t tasks_max;
+
+ bool delegate;
};
#include "unit.h"