summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-18 23:13:15 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-20 12:45:50 -0500
commit77fab2a91c801985bd8efb293319935a3cdc1dcf (patch)
tree86503806ab9a1ad4aedeeb4b268743dc8170a982 /src/basic
parentf08e9287200772c9a201d9f988dd78ffe2fc7ea4 (diff)
pid1: add ./configure switch to select default cgroup hierarchy
The default default is set to "legacy", with "hybrid" and "unified" being the other two alternatives. There invert the behaviour for systemd.legacy_systemd_cgroup_controller: if it is not specified on the kernel command line, "hybrid" is used if selected as the default. If this option is specified, "hybrid" is used if false, and full "legacy" if true. Also make all fields in the configure summary lowercase (unless they are capitalized names) for consistency. v2: - update for the fixed interpreation of systemd.legacy_systemd_cgroup_controller
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/cgroup-util.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 9208873d9c..f80b6cacfb 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -2408,23 +2408,24 @@ bool cg_is_unified_wanted(void) {
static thread_local int wanted = -1;
int r;
bool b;
+ const bool is_default = DEFAULT_HIERARCHY == CGROUP_UNIFIED_ALL;
/* If the hierarchy is already mounted, then follow whatever
* was chosen for it. */
if (cg_unified_flush() >= 0)
return cg_all_unified();
- /* Otherwise, let's see what the kernel command line has to
- * say. Since checking that is expensive, let's cache the
- * result. */
+ /* If we have a cached value, return that. */
if (wanted >= 0)
return wanted;
+ /* Otherwise, let's see what the kernel command line has to say.
+ * Since checking is expensive, cache a non-error result. */
r = proc_cmdline_get_bool("systemd.unified_cgroup_hierarchy", &b);
if (r < 0)
- return false;
+ return is_default;
- return (wanted = r > 0 ? b : false);
+ return (wanted = r > 0 ? b : is_default);
}
bool cg_is_legacy_wanted(void) {
@@ -2435,6 +2436,7 @@ bool cg_is_unified_systemd_controller_wanted(void) {
static thread_local int wanted = -1;
int r;
bool b;
+ const bool is_default = DEFAULT_HIERARCHY == CGROUP_UNIFIED_SYSTEMD;
/* If the unified hierarchy is requested in full, no need to
* bother with this. */
@@ -2446,19 +2448,19 @@ bool cg_is_unified_systemd_controller_wanted(void) {
if (cg_unified_flush() >= 0)
return cg_unified(SYSTEMD_CGROUP_CONTROLLER);
- /* Otherwise, let's see what the kernel command line has to
- * say. Since checking that is expensive, let's cache the
- * result. */
+ /* If we have a cached value, return that. */
if (wanted >= 0)
return wanted;
+ /* Otherwise, let's see what the kernel command line has to say.
+ * Since checking is expensive, cache a non-error result. */
r = proc_cmdline_get_bool("systemd.legacy_systemd_cgroup_controller", &b);
if (r < 0)
- return false;
+ return is_default;
/* The meaning of the kernel option is reversed wrt. to the return value
* of this function, hence the negation. */
- return (wanted = r > 0 ? !b : false);
+ return (wanted = r > 0 ? !b : is_default);
}
int cg_weight_parse(const char *s, uint64_t *ret) {