meson: add -Dmemory-accounting-default=true|false

This makes it easy to set the default for distributions and users which want to
default to off because they primarily use older kernels.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-02-15 11:43:08 +01:00
parent e0c46a7364
commit 444d586333
9 changed files with 30 additions and 18 deletions

18
NEWS
View File

@ -6,15 +6,15 @@ CHANGES WITH 238 in spe:
discussions with the upstream control group maintainers we learnt discussions with the upstream control group maintainers we learnt
that the negative impact of cgroup memory accounting on current that the negative impact of cgroup memory accounting on current
kernels is finally relatively minimal, so that it should be safe to kernels is finally relatively minimal, so that it should be safe to
enable this by default without affecting system performance too enable this by default without affecting system performance. Besides
much. Besides memory accounting only tasks accounting is turned on by memory accounting only task accounting is turned on by default, all
default, all other forms of resource accounting (CPU, IO, IP) remain other forms of resource accounting (CPU, IO, IP) remain off for now,
off for now, because it's not clear yet that their impact is small because it's not clear yet that their impact is small enough to move
enough to move from opt-in to opt-out for them, too. We recommend from opt-in to opt-out. We recommend downstreams to leave memory
downstreams to leave memory accounting on by default, however in some accounting on by default if kernel 4.14 or higher is are primarily
situations it might be wise to revert this change of defaults, in used. On very resource constrained systems or when support for old
particular on very resource constrained systems or when support for kernels is a necessity, -Dmemory-accounting-default=false can be used
old kernels is a necessity. to revert this change.
CHANGES WITH 237: CHANGES WITH 237:

View File

@ -6,3 +6,4 @@
<!ENTITY systemenvgeneratordir @SYSTEM_ENV_GENERATOR_PATH@> <!ENTITY systemenvgeneratordir @SYSTEM_ENV_GENERATOR_PATH@>
<!ENTITY userenvgeneratordir @USER_ENV_GENERATOR_PATH@> <!ENTITY userenvgeneratordir @USER_ENV_GENERATOR_PATH@>
<!ENTITY CERTIFICATE_ROOT @CERTIFICATE_ROOT@> <!ENTITY CERTIFICATE_ROOT @CERTIFICATE_ROOT@>
<!ENTITY MEMORY_ACCOUNTING_DEFAULT @MEMORY_ACCOUNTING_DEFAULT_ON_OFF@>

View File

@ -1,6 +1,9 @@
<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*--> <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY % entities SYSTEM "custom-entities.ent" >
%entities;
]>
<!-- <!--
SPDX-License-Identifier: LGPL-2.1+ SPDX-License-Identifier: LGPL-2.1+
@ -338,8 +341,9 @@
<varname>CPUAccounting=</varname>, <varname>BlockIOAccounting=</varname>, <varname>MemoryAccounting=</varname>, <varname>CPUAccounting=</varname>, <varname>BlockIOAccounting=</varname>, <varname>MemoryAccounting=</varname>,
<varname>TasksAccounting=</varname> and <varname>IPAccounting=</varname>. See <varname>TasksAccounting=</varname> and <varname>IPAccounting=</varname>. See
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details on the per-unit settings. <varname>DefaultTasksAccounting=</varname> and for details on the per-unit settings. <varname>DefaultTasksAccounting=</varname> defaults to on,
<varname>DefaultMemoryAccounting=</varname> default to on, the other three settings to off.</para></listitem> <varname>DefaultMemoryAccounting=</varname> to &MEMORY_ACCOUNTING_DEFAULT;,
the other three settings to off.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>

View File

@ -172,6 +172,8 @@ if pamconfdir == ''
pamconfdir = join_paths(sysconfdir, 'pam.d') pamconfdir = join_paths(sysconfdir, 'pam.d')
endif endif
memory_accounting_default = get_option('memory-accounting-default')
conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir) conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system')) conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir) conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
@ -217,6 +219,8 @@ conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlib
conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg')) conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg')) conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd')) conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false')
conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_ON_OFF', memory_accounting_default ? 'on' : 'off')
conf.set_quoted('ABS_BUILD_DIR', meson.build_root()) conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
conf.set_quoted('ABS_SRC_DIR', meson.source_root()) conf.set_quoted('ABS_SRC_DIR', meson.source_root())
@ -257,6 +261,7 @@ substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path) substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local')) substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local')) substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
##################################################################### #####################################################################

View File

@ -53,6 +53,8 @@ option('debug-tty', type : 'string', value : '/dev/tty9',
description : 'specify the tty device for debug shell') description : 'specify the tty device for debug shell')
option('debug', type : 'string', option('debug', type : 'string',
description : 'enable extra debugging (hashmap,mmap-cache)') description : 'enable extra debugging (hashmap,mmap-cache)')
option('memory-accounting-default', type : 'boolean',
description : 'enable MemoryAccounting= by default')
option('utmp', type : 'boolean', option('utmp', type : 'boolean',
description : 'support for utmp/wtmp log handling') description : 'support for utmp/wtmp log handling')

View File

@ -135,7 +135,7 @@ static bool arg_default_cpu_accounting = false;
static bool arg_default_io_accounting = false; static bool arg_default_io_accounting = false;
static bool arg_default_ip_accounting = false; static bool arg_default_ip_accounting = false;
static bool arg_default_blockio_accounting = false; static bool arg_default_blockio_accounting = false;
static bool arg_default_memory_accounting = true; static bool arg_default_memory_accounting = MEMORY_ACCOUNTING_DEFAULT;
static bool arg_default_tasks_accounting = true; static bool arg_default_tasks_accounting = true;
static uint64_t arg_default_tasks_max = UINT64_MAX; static uint64_t arg_default_tasks_max = UINT64_MAX;
static sd_id128_t arg_machine_id = {}; static sd_id128_t arg_machine_id = {};

View File

@ -673,7 +673,7 @@ int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) {
m->unit_file_scope = scope; m->unit_file_scope = scope;
m->exit_code = _MANAGER_EXIT_CODE_INVALID; m->exit_code = _MANAGER_EXIT_CODE_INVALID;
m->default_timer_accuracy_usec = USEC_PER_MINUTE; m->default_timer_accuracy_usec = USEC_PER_MINUTE;
m->default_memory_accounting = true; m->default_memory_accounting = MEMORY_ACCOUNTING_DEFAULT;
m->default_tasks_accounting = true; m->default_tasks_accounting = true;
m->default_tasks_max = UINT64_MAX; m->default_tasks_max = UINT64_MAX;
m->default_timeout_start_usec = DEFAULT_TIMEOUT_USEC; m->default_timeout_start_usec = DEFAULT_TIMEOUT_USEC;

View File

@ -186,7 +186,8 @@ systemd_shutdown_sources = files('''
in_files = [['macros.systemd', rpmmacrosdir], in_files = [['macros.systemd', rpmmacrosdir],
['triggers.systemd', ''], ['triggers.systemd', ''],
['systemd.pc', pkgconfigdatadir]] ['systemd.pc', pkgconfigdatadir],
['system.conf', pkgsysconfdir]]
foreach item : in_files foreach item : in_files
file = item[0] file = item[0]
@ -225,8 +226,7 @@ i18n.merge_file(
install : install_polkit, install : install_polkit,
install_dir : polkitpolicydir) install_dir : polkitpolicydir)
install_data('system.conf', install_data('user.conf',
'user.conf',
install_dir : pkgsysconfdir) install_dir : pkgsysconfdir)
meson.add_install_script('sh', '-c', mkdir_p.format(systemshutdowndir)) meson.add_install_script('sh', '-c', mkdir_p.format(systemshutdowndir))

View File

@ -42,7 +42,7 @@
#DefaultIOAccounting=no #DefaultIOAccounting=no
#DefaultIPAccounting=no #DefaultIPAccounting=no
#DefaultBlockIOAccounting=no #DefaultBlockIOAccounting=no
#DefaultMemoryAccounting=yes #DefaultMemoryAccounting=@MEMORY_ACCOUNTING_DEFAULT@
#DefaultTasksAccounting=yes #DefaultTasksAccounting=yes
#DefaultTasksMax=15% #DefaultTasksMax=15%
#DefaultLimitCPU= #DefaultLimitCPU=