1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-13 17:18:18 +03:00

core: change TasksMax= default for system services to 15%

As it turns out 512 is max number of tasks per service is hit by too many
applications, hence let's bump it a bit, and make it relative to the system's
maximum number of PIDs. With this change the new default is 15%. At the
kernel's default pids_max value of 32768 this translates to 4915. At machined's
default TasksMax= setting of 16384 this translates to 2457.

Why 15%? Because it sounds like a round number and is close enough to 4096
which I was going for, i.e. an eight-fold increase over the old 512

Summary:

            | on the host | in a container
old default |         512 |           512
new default |        4915 |          2457
This commit is contained in:
Lennart Poettering 2016-07-19 17:29:00 +02:00
parent c06eec15d5
commit 79baeeb96d
4 changed files with 9 additions and 8 deletions

View File

@ -325,12 +325,11 @@
<varlistentry> <varlistentry>
<term><varname>DefaultTasksMax=</varname></term> <term><varname>DefaultTasksMax=</varname></term>
<listitem><para>Configure the default value for the per-unit <listitem><para>Configure the default value for the per-unit <varname>TasksMax=</varname> setting. See
<varname>TasksMax=</varname> setting. See
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details. This setting applies to all unit types that for details. This setting applies to all unit types that support resource control settings, with the exception
support resource control settings, with the exception of slice of slice units. Defaults to 15%, which equals 4915 with the kernel's defaults on the host, but might be smaller
units. Defaults to 512.</para></listitem> in OS containers.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>

View File

@ -127,7 +127,7 @@ static bool arg_default_io_accounting = false;
static bool arg_default_blockio_accounting = false; static bool arg_default_blockio_accounting = false;
static bool arg_default_memory_accounting = false; static bool arg_default_memory_accounting = false;
static bool arg_default_tasks_accounting = true; static bool arg_default_tasks_accounting = true;
static uint64_t arg_default_tasks_max = UINT64_C(512); static uint64_t arg_default_tasks_max = UINT64_MAX;
static sd_id128_t arg_machine_id = {}; static sd_id128_t arg_machine_id = {};
noreturn static void freeze_or_reboot(void) { noreturn static void freeze_or_reboot(void) {
@ -1558,6 +1558,8 @@ int main(int argc, char *argv[]) {
(void) reset_all_signal_handlers(); (void) reset_all_signal_handlers();
(void) ignore_signals(SIGNALS_IGNORE, -1); (void) ignore_signals(SIGNALS_IGNORE, -1);
arg_default_tasks_max = system_tasks_max_scale(15U, 100U); /* 15% the system PIDs equals 4915 by default. */
if (parse_config_file() < 0) { if (parse_config_file() < 0) {
error_message = "Failed to parse config file"; error_message = "Failed to parse config file";
goto finish; goto finish;

View File

@ -569,7 +569,7 @@ int manager_new(UnitFileScope scope, bool test_run, Manager **_m) {
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_tasks_accounting = true; m->default_tasks_accounting = true;
m->default_tasks_max = UINT64_C(512); m->default_tasks_max = UINT64_MAX;
#ifdef ENABLE_EFI #ifdef ENABLE_EFI
if (MANAGER_IS_SYSTEM(m) && detect_container() <= 0) if (MANAGER_IS_SYSTEM(m) && detect_container() <= 0)

View File

@ -42,7 +42,7 @@
#DefaultBlockIOAccounting=no #DefaultBlockIOAccounting=no
#DefaultMemoryAccounting=no #DefaultMemoryAccounting=no
#DefaultTasksAccounting=yes #DefaultTasksAccounting=yes
#DefaultTasksMax=512 #DefaultTasksMax=15%
#DefaultLimitCPU= #DefaultLimitCPU=
#DefaultLimitFSIZE= #DefaultLimitFSIZE=
#DefaultLimitDATA= #DefaultLimitDATA=