From 0af20ea2ee2af2bcf2258e7a8e1a13181a6a75d6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 13 Nov 2015 17:13:55 +0100 Subject: core: add new DefaultTasksMax= setting for system.conf This allows initializing the TasksMax= setting of all units by default to some fixed value, instead of leaving it at infinity as before. --- src/core/manager.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/core/manager.c') diff --git a/src/core/manager.c b/src/core/manager.c index f695b8a66c..fd915d748c 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -577,6 +577,7 @@ int manager_new(ManagerRunningAs running_as, bool test_run, Manager **_m) { m->running_as = running_as; m->exit_code = _MANAGER_EXIT_CODE_INVALID; m->default_timer_accuracy_usec = USEC_PER_MINUTE; + m->default_tasks_max = (uint64_t) -1; /* Prepare log fields we can use for structured logging */ m->unit_log_field = unit_log_fields[running_as]; -- cgit v1.2.3-54-g00ecf From 9ded9cd14cc03c67291b10a5c42ce5094ba0912f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 13 Nov 2015 19:28:32 +0100 Subject: 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 --- man/systemd-system.conf.xml | 6 ++++-- src/core/main.c | 4 ++-- src/core/manager.c | 3 ++- src/core/system.conf | 4 ++-- src/test/test-cgroup-mask.c | 10 ++++++++++ 5 files changed, 20 insertions(+), 7 deletions(-) (limited to 'src/core/manager.c') diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml index 0050f24f8e..ead52951da 100644 --- a/man/systemd-system.conf.xml +++ b/man/systemd-system.conf.xml @@ -317,7 +317,9 @@ MemoryAccounting= and TasksAccounting=. See systemd.resource-control5 - for details on the per-unit settings. + for details on the per-unit + settings. DefaulTasksAccounting= defaults + to on, the other three settings to off. @@ -328,7 +330,7 @@ systemd.resource-control5 for details. This setting applies to all unit types that support resource control settings, with the exception of slice - units. + units. Defaults to 512. diff --git a/src/core/main.c b/src/core/main.c index f8e1d88335..a09ce0f083 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -125,8 +125,8 @@ static FILE* arg_serialization = NULL; static bool arg_default_cpu_accounting = false; static bool arg_default_blockio_accounting = false; static bool arg_default_memory_accounting = false; -static bool arg_default_tasks_accounting = false; -static uint64_t arg_default_tasks_max = (uint64_t) -1; +static bool arg_default_tasks_accounting = true; +static uint64_t arg_default_tasks_max = UINT64_C(512); static void pager_open_if_enabled(void) { diff --git a/src/core/manager.c b/src/core/manager.c index fd915d748c..edff6758c5 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -577,7 +577,8 @@ int manager_new(ManagerRunningAs running_as, bool test_run, Manager **_m) { m->running_as = running_as; m->exit_code = _MANAGER_EXIT_CODE_INVALID; 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 */ m->unit_log_field = unit_log_fields[running_as]; diff --git a/src/core/system.conf b/src/core/system.conf index 63bff085eb..e2ded27333 100644 --- a/src/core/system.conf +++ b/src/core/system.conf @@ -40,8 +40,8 @@ #DefaultCPUAccounting=no #DefaultBlockIOAccounting=no #DefaultMemoryAccounting=no -#DefaultTasksAccounting=no -#DefaultTasksMax= +#DefaultTasksAccounting=yes +#DefaultTasksMax=512 #DefaultLimitCPU= #DefaultLimitFSIZE= #DefaultLimitDATA= diff --git a/src/test/test-cgroup-mask.c b/src/test/test-cgroup-mask.c index de6c421b82..85b0d607d6 100644 --- a/src/test/test-cgroup-mask.c +++ b/src/test/test-cgroup-mask.c @@ -40,6 +40,16 @@ static int test_cgroup_mask(void) { puts("manager_new: Permission denied. Skipping test."); 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(manager_startup(m, serial, fdset) >= 0); -- cgit v1.2.3-54-g00ecf