Merge pull request #66984 from flokli/systemd-cgroup-accounting

nixos/systemd: enable systemd cgroup accounting by default
This commit is contained in:
Florian Klink 2019-08-27 11:38:28 +02:00 committed by GitHub
commit 9a02d9c75e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 9 deletions

View File

@ -512,6 +512,14 @@
Use <literal>rspamd</literal> in proxy mode instead.
</para>
</listitem>
<listitem>
<para>
systemd cgroup accounting via the
<link linkend="opt-systemd.enableCgroupAccounting">systemd.enableCgroupAccounting</link>
option is now enabled by default. It now also enables the more recent Block IO and IP accounting
features.
</para>
</listitem>
</itemizedlist>
</section>
</section>

View File

@ -537,7 +537,7 @@ in
};
systemd.enableCgroupAccounting = mkOption {
default = false;
default = true;
type = types.bool;
description = ''
Whether to enable cgroup accounting.
@ -804,10 +804,10 @@ in
[Manager]
${optionalString config.systemd.enableCgroupAccounting ''
DefaultCPUAccounting=yes
DefaultBlockIOAccounting=yes
DefaultIOAccounting=yes
DefaultBlockIOAccounting=yes
DefaultMemoryAccounting=yes
DefaultTasksAccounting=yes
DefaultIPAccounting=yes
''}
DefaultLimitCORE=infinity
${config.systemd.extraConfig}

View File

@ -89,5 +89,12 @@ import ./make-test.nix ({ pkgs, ... }: {
$machine->waitForUnit('multi-user.target');
$machine->succeed('sysctl net.core.default_qdisc | grep -q "fq_codel"');
};
# Test cgroup accounting is enabled
subtest "systemd cgroup accounting is enabled", sub {
$machine->waitForUnit('multi-user.target');
$machine->succeed('systemctl show testservice1.service -p IOAccounting | grep -q "yes"');
$machine->succeed('systemctl status testservice1.service | grep -q "CPU:"');
};
'';
})