Skip to content

Commit 9ded9cd

Browse files
committed
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
1 parent 702d4e6 commit 9ded9cd

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

man/systemd-system.conf.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@
317317
<varname>MemoryAccounting=</varname> and
318318
<varname>TasksAccounting=</varname>. See
319319
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
320-
for details on the per-unit settings.</para></listitem>
320+
for details on the per-unit
321+
settings. <varname>DefaulTasksAccounting=</varname> defaults
322+
to on, the other three settings to off.</para></listitem>
321323
</varlistentry>
322324

323325
<varlistentry>
@@ -328,7 +330,7 @@
328330
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
329331
for details. This setting applies to all unit types that
330332
support resource control settings, with the exception of slice
331-
units.</para></listitem>
333+
units. Defaults to 512.</para></listitem>
332334
</varlistentry>
333335

334336
<varlistentry>

src/core/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ static FILE* arg_serialization = NULL;
125125
static bool arg_default_cpu_accounting = false;
126126
static bool arg_default_blockio_accounting = false;
127127
static bool arg_default_memory_accounting = false;
128-
static bool arg_default_tasks_accounting = false;
129-
static uint64_t arg_default_tasks_max = (uint64_t) -1;
128+
static bool arg_default_tasks_accounting = true;
129+
static uint64_t arg_default_tasks_max = UINT64_C(512);
130130

131131
static void pager_open_if_enabled(void) {
132132

src/core/manager.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,8 @@ int manager_new(ManagerRunningAs running_as, bool test_run, Manager **_m) {
577577
m->running_as = running_as;
578578
m->exit_code = _MANAGER_EXIT_CODE_INVALID;
579579
m->default_timer_accuracy_usec = USEC_PER_MINUTE;
580-
m->default_tasks_max = (uint64_t) -1;
580+
m->default_tasks_accounting = true;
581+
m->default_tasks_max = UINT64_C(512);
581582

582583
/* Prepare log fields we can use for structured logging */
583584
m->unit_log_field = unit_log_fields[running_as];

src/core/system.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
#DefaultCPUAccounting=no
4141
#DefaultBlockIOAccounting=no
4242
#DefaultMemoryAccounting=no
43-
#DefaultTasksAccounting=no
44-
#DefaultTasksMax=
43+
#DefaultTasksAccounting=yes
44+
#DefaultTasksMax=512
4545
#DefaultLimitCPU=
4646
#DefaultLimitFSIZE=
4747
#DefaultLimitDATA=

src/test/test-cgroup-mask.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ static int test_cgroup_mask(void) {
4040
puts("manager_new: Permission denied. Skipping test.");
4141
return EXIT_TEST_SKIP;
4242
}
43+
44+
/* Turn off all kinds of default accouning, so that we can
45+
* verify the masks resulting of our configuration and nothing
46+
* else. */
47+
m->default_cpu_accounting =
48+
m->default_memory_accounting =
49+
m->default_blockio_accounting =
50+
m->default_tasks_accounting = false;
51+
m->default_tasks_max = (uint64_t) -1;
52+
4353
assert_se(r >= 0);
4454
assert_se(manager_startup(m, serial, fdset) >= 0);
4555

0 commit comments

Comments
 (0)