1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

core: enable TasksMax= for all services by default, and set it to 512

Also, enable TasksAccounting= for all services by default, too.

See:

http://lists.freedesktop.org/archives/systemd-devel/2015-November/035006.html
This commit is contained in:
Lennart Poettering 2015-11-13 19:28:32 +01:00
parent 702d4e6f14
commit 9ded9cd14c
5 changed files with 20 additions and 7 deletions

View File

@ -317,7 +317,9 @@
<varname>MemoryAccounting=</varname> and <varname>MemoryAccounting=</varname> and
<varname>TasksAccounting=</varname>. See <varname>TasksAccounting=</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.</para></listitem> for details on the per-unit
settings. <varname>DefaulTasksAccounting=</varname> defaults
to on, the other three settings to off.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
@ -328,7 +330,7 @@
<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 of slice support resource control settings, with the exception of slice
units.</para></listitem> units. Defaults to 512.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>

View File

@ -125,8 +125,8 @@ static FILE* arg_serialization = NULL;
static bool arg_default_cpu_accounting = false; static bool arg_default_cpu_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 = false; static bool arg_default_tasks_accounting = true;
static uint64_t arg_default_tasks_max = (uint64_t) -1; static uint64_t arg_default_tasks_max = UINT64_C(512);
static void pager_open_if_enabled(void) { static void pager_open_if_enabled(void) {

View File

@ -577,7 +577,8 @@ int manager_new(ManagerRunningAs running_as, bool test_run, Manager **_m) {
m->running_as = running_as; m->running_as = running_as;
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_max = (uint64_t) -1; m->default_tasks_accounting = true;
m->default_tasks_max = UINT64_C(512);
/* Prepare log fields we can use for structured logging */ /* Prepare log fields we can use for structured logging */
m->unit_log_field = unit_log_fields[running_as]; m->unit_log_field = unit_log_fields[running_as];

View File

@ -40,8 +40,8 @@
#DefaultCPUAccounting=no #DefaultCPUAccounting=no
#DefaultBlockIOAccounting=no #DefaultBlockIOAccounting=no
#DefaultMemoryAccounting=no #DefaultMemoryAccounting=no
#DefaultTasksAccounting=no #DefaultTasksAccounting=yes
#DefaultTasksMax= #DefaultTasksMax=512
#DefaultLimitCPU= #DefaultLimitCPU=
#DefaultLimitFSIZE= #DefaultLimitFSIZE=
#DefaultLimitDATA= #DefaultLimitDATA=

View File

@ -40,6 +40,16 @@ static int test_cgroup_mask(void) {
puts("manager_new: Permission denied. Skipping test."); puts("manager_new: Permission denied. Skipping test.");
return EXIT_TEST_SKIP; return EXIT_TEST_SKIP;
} }
/* Turn off all kinds of default accouning, so that we can
* verify the masks resulting of our configuration and nothing
* else. */
m->default_cpu_accounting =
m->default_memory_accounting =
m->default_blockio_accounting =
m->default_tasks_accounting = false;
m->default_tasks_max = (uint64_t) -1;
assert_se(r >= 0); assert_se(r >= 0);
assert_se(manager_startup(m, serial, fdset) >= 0); assert_se(manager_startup(m, serial, fdset) >= 0);