mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
meson: drop default-hierarchy= option, always use unified
This commit is contained in:
parent
f2512de82d
commit
31323f21bb
12
meson.build
12
meson.build
@ -761,17 +761,6 @@ if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0
|
||||
endif
|
||||
conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
|
||||
|
||||
default_hierarchy = get_option('default-hierarchy')
|
||||
conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
|
||||
description : 'default cgroup hierarchy as string')
|
||||
if default_hierarchy == 'legacy'
|
||||
conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
|
||||
elif default_hierarchy == 'hybrid'
|
||||
conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
|
||||
else
|
||||
conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
|
||||
endif
|
||||
|
||||
extra_net_naming_schemes = []
|
||||
extra_net_naming_map = []
|
||||
foreach scheme: get_option('extra-net-naming-schemes').split(',')
|
||||
@ -2768,7 +2757,6 @@ summary({
|
||||
'default LLMNR mode' : default_llmnr,
|
||||
'default DNS servers' : dns_servers.split(' '),
|
||||
'default NTP servers' : ntp_servers.split(' '),
|
||||
'default cgroup hierarchy' : default_hierarchy,
|
||||
'default net.naming-scheme value' : default_net_naming_scheme,
|
||||
'default KillUserProcesses value' : kill_user_processes,
|
||||
'default locale' : default_locale,
|
||||
|
@ -227,8 +227,8 @@ option('configfiledir', type : 'string', value : '',
|
||||
option('fallback-hostname', type : 'string', value : 'localhost',
|
||||
description : 'the hostname used if none configured')
|
||||
option('default-hierarchy', type : 'combo',
|
||||
choices : ['legacy', 'hybrid', 'unified'], value : 'unified',
|
||||
description : 'default cgroup hierarchy')
|
||||
choices : ['legacy', 'hybrid', 'unified'], deprecated : true,
|
||||
description : '''This option is deprecated and will be removed in a future release''')
|
||||
option('extra-net-naming-schemes', type : 'string',
|
||||
description : 'comma-separated list of extra net.naming-scheme= definitions')
|
||||
option('default-net-naming-scheme', type : 'string', value : 'latest',
|
||||
|
@ -244,7 +244,6 @@ const char* const systemd_features =
|
||||
" -LIBARCHIVE"
|
||||
#endif
|
||||
|
||||
" default-hierarchy=" DEFAULT_HIERARCHY_NAME
|
||||
;
|
||||
|
||||
static char *systemd_features_with_color(void) {
|
||||
|
@ -81,9 +81,6 @@ static int cg_any_controller_used_for_v1(void) {
|
||||
|
||||
bool cg_is_unified_wanted(void) {
|
||||
static thread_local int wanted = -1;
|
||||
bool b;
|
||||
const bool is_default = DEFAULT_HIERARCHY == CGROUP_UNIFIED_ALL;
|
||||
_cleanup_free_ char *c = NULL;
|
||||
int r;
|
||||
|
||||
/* If we have a cached value, return that. */
|
||||
@ -96,21 +93,20 @@ bool cg_is_unified_wanted(void) {
|
||||
return (wanted = r >= CGROUP_UNIFIED_ALL);
|
||||
|
||||
/* If we were explicitly passed systemd.unified_cgroup_hierarchy, respect that. */
|
||||
bool b;
|
||||
r = proc_cmdline_get_bool("systemd.unified_cgroup_hierarchy", /* flags = */ 0, &b);
|
||||
if (r > 0)
|
||||
return (wanted = b);
|
||||
|
||||
/* If we passed cgroup_no_v1=all with no other instructions, it seems highly unlikely that we want to
|
||||
* use hybrid or legacy hierarchy. */
|
||||
_cleanup_free_ char *c = NULL;
|
||||
r = proc_cmdline_get_key("cgroup_no_v1", 0, &c);
|
||||
if (r > 0 && streq_ptr(c, "all"))
|
||||
return (wanted = true);
|
||||
|
||||
/* If any controller is in use as v1, don't use unified. */
|
||||
if (cg_any_controller_used_for_v1() > 0)
|
||||
return (wanted = false);
|
||||
|
||||
return (wanted = is_default);
|
||||
return (wanted = cg_any_controller_used_for_v1() <= 0);
|
||||
}
|
||||
|
||||
bool cg_is_legacy_wanted(void) {
|
||||
@ -132,10 +128,6 @@ bool cg_is_legacy_wanted(void) {
|
||||
bool cg_is_hybrid_wanted(void) {
|
||||
static thread_local int wanted = -1;
|
||||
int r;
|
||||
bool b;
|
||||
const bool is_default = DEFAULT_HIERARCHY >= CGROUP_UNIFIED_SYSTEMD;
|
||||
/* We default to true if the default is "hybrid", obviously, but also when the default is "unified",
|
||||
* because if we get called, it means that unified hierarchy was not mounted. */
|
||||
|
||||
/* If we have a cached value, return that. */
|
||||
if (wanted >= 0)
|
||||
@ -146,12 +138,17 @@ bool cg_is_hybrid_wanted(void) {
|
||||
return (wanted = false);
|
||||
|
||||
/* 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", /* flags = */ 0, &b);
|
||||
|
||||
/* The meaning of the kernel option is reversed wrt. to the return value of this function, hence the
|
||||
* a non-error result.
|
||||
* The meaning of the kernel option is reversed wrt. to the return value of this function, hence the
|
||||
* negation. */
|
||||
return (wanted = r > 0 ? !b : is_default);
|
||||
bool b;
|
||||
r = proc_cmdline_get_bool("systemd.legacy_systemd_cgroup_controller", /* flags = */ 0, &b);
|
||||
if (r > 0)
|
||||
return (wanted = !b);
|
||||
|
||||
/* The default hierarchy is "unified". But if this is reached, it means that unified hierarchy was
|
||||
* not mounted, so return true too. */
|
||||
return (wanted = true);
|
||||
}
|
||||
|
||||
bool cg_is_legacy_force_enabled(void) {
|
||||
|
@ -16,10 +16,8 @@ static void test_is_wanted_print_one(bool header) {
|
||||
log_info("-- %s --", __func__);
|
||||
assert_se(proc_cmdline(&cmdline) >= 0);
|
||||
log_info("cmdline: %s", cmdline);
|
||||
if (header) {
|
||||
log_info("default-hierarchy=" DEFAULT_HIERARCHY_NAME);
|
||||
if (header)
|
||||
(void) system("findmnt -n /sys/fs/cgroup");
|
||||
}
|
||||
|
||||
log_info("is_unified_wanted() → %s", yes_no(cg_is_unified_wanted()));
|
||||
log_info("is_hybrid_wanted() → %s", yes_no(cg_is_hybrid_wanted()));
|
||||
|
Loading…
Reference in New Issue
Block a user