···719719 </listitem>
720720 <listitem>
721721 <para>
722722+ systemd-oomd is enabled by default. Depending on which systemd
723723+ units have <literal>ManagedOOMSwap=kill</literal> or
724724+ <literal>ManagedOOMMemoryPressure=kill</literal>, systemd-oomd
725725+ will SIGKILL all the processes under the appropriate
726726+ descendant cgroups when the configured limits are exceeded.
727727+ NixOS does currently not configure cgroups with oomd by
728728+ default, this can be enabled using
729729+ <link xlink:href="options.html#opt-systemd.oomd.enableRootSlice">systemd.oomd.enableRootSlice</link>,
730730+ <link xlink:href="options.html#opt-systemd.oomd.enableSystemSlice">systemd.oomd.enableSystemSlice</link>,
731731+ and
732732+ <link xlink:href="options.html#opt-systemd.oomd.enableUserServices">systemd.oomd.enableUserServices</link>.
733733+ </para>
734734+ </listitem>
735735+ <listitem>
736736+ <para>
722737 The <literal>pass-secret-service</literal> package now
723738 includes systemd units from upstream, so adding it to the
724739 NixOS <literal>services.dbus.packages</literal> option will
+9
nixos/doc/manual/release-notes/rl-2211.section.md
···235235236236- Add udev rules for the Teensy family of microcontrollers.
237237238238+- systemd-oomd is enabled by default. Depending on which systemd units have
239239+ `ManagedOOMSwap=kill` or `ManagedOOMMemoryPressure=kill`, systemd-oomd will
240240+ SIGKILL all the processes under the appropriate descendant cgroups when the
241241+ configured limits are exceeded. NixOS does currently not configure cgroups
242242+ with oomd by default, this can be enabled using
243243+ [systemd.oomd.enableRootSlice](options.html#opt-systemd.oomd.enableRootSlice),
244244+ [systemd.oomd.enableSystemSlice](options.html#opt-systemd.oomd.enableSystemSlice),
245245+ and [systemd.oomd.enableUserServices](options.html#opt-systemd.oomd.enableUserServices).
246246+238247- The `pass-secret-service` package now includes systemd units from upstream, so adding it to the NixOS `services.dbus.packages` option will make it start automatically as a systemd user service when an application tries to talk to the libsecret D-Bus API.
239248240249- There is a new module for AMD SEV CPU functionality, which grants access to the hardware.
···11+import ./make-test-python.nix ({ pkgs, ... }:
22+33+{
44+ name = "systemd-oomd";
55+66+ nodes.machine = { pkgs, ... }: {
77+ systemd.oomd.extraConfig.DefaultMemoryPressureDurationSec = "1s"; # makes the test faster
88+ # Kill cgroups when more than 1% pressure is encountered
99+ systemd.slices."-".sliceConfig = {
1010+ ManagedOOMMemoryPressure = "kill";
1111+ ManagedOOMMemoryPressureLimit = "1%";
1212+ };
1313+ # A service to bring the system under memory pressure
1414+ systemd.services.testservice = {
1515+ serviceConfig.ExecStart = "${pkgs.coreutils}/bin/tail /dev/zero";
1616+ };
1717+ # Do not kill the backdoor
1818+ systemd.services.backdoor.serviceConfig.ManagedOOMMemoryPressure = "auto";
1919+2020+ virtualisation.memorySize = 1024;
2121+ };
2222+2323+ testScript = ''
2424+ # Start the system
2525+ machine.wait_for_unit("multi-user.target")
2626+ machine.succeed("oomctl")
2727+2828+ # Bring the system into memory pressure
2929+ machine.succeed("echo 0 > /proc/sys/vm/panic_on_oom") # NixOS tests kill the VM when the OOM killer is invoked - override this
3030+ machine.succeed("systemctl start testservice")
3131+3232+ # Wait for oomd to kill something
3333+ # Matches these lines:
3434+ # systemd-oomd[508]: Killed /system.slice/systemd-udevd.service due to memory pressure for / being 3.26% > 1.00% for > 1s with reclaim activity
3535+ machine.wait_until_succeeds("journalctl -b | grep -q 'due to memory pressure for'")
3636+ '';
3737+})