From Fedora Project Wiki

No edit summary
mNo edit summary
 
(9 intermediate revisions by the same user not shown)
Line 4: Line 4:
|setup=
|setup=
* This test case should be performed on either bare-metal or virtual machines.
* This test case should be performed on either bare-metal or virtual machines.
* Check that you are running systemd 248~rc1 or higher with `systemctl --version`.
* Check that you are running systemd 248~rc4 or higher with `systemctl --version`.
* Ensure the systemd-oomd-defaults package is installed (included with Fedora 34).
* Ensure the systemd-oomd-defaults package is installed (included with Fedora 34).
* Boot the system and log in as a regular user.
* Boot the system and log in as a regular user.
* Ensure no other conflicting userspace OOM killers are running. For example you may have to stop earlyoom:
<pre>
sudo systemctl stop earlyoom
</pre>


|actions=
|actions=
Line 18: Line 22:
systemd-run --user -r --unit systoomd_swap_test tail /dev/zero
systemd-run --user -r --unit systoomd_swap_test tail /dev/zero
</pre>
</pre>
* After verifying the results below, reset the unit:
* Make sure to reset the test unit after verifying the results:
<pre>
<pre>
systemctl --user stop systoomd_swap_test.service
systemctl --user reset-failed systoomd_swap_test.service
</pre>
</pre>


|results=
|results=
* systemd-oomd will have killed the unit started above. You can verify by checking for log lines that say something about "Swap used <...> is more than 90%" and "systemd-oomd killed <...> process(es)" with `journalctl`. The output of `systemctl --user status systoomd_swap_test` should say the unit is failed and killed (with no mention of oom-kill).
* systemd-oomd will have killed the unit started above.
* You can verify by checking for some of the relevant log lines with `journalctl`: "Swap used <...> is more than 90%" or "systemd-oomd killed <...> process(es)"
* The output of `systemctl --user status systoomd_swap_test` should say the unit is killed. The kill can be racy so you may or may not see "systemd-oomd killed <...> process(es) in this unit". But if you see that message and also mention of "oom-kill" (which means the kernel OOM killer also kicked in) please note that in the comments/results. Otherwise, if it was a systemd-oomd only kill there will be no mention of "oom-kill".
* Swap used should be below 90% (use `free -h`)
* Swap used should be below 90% (use `free -h`)
}}
}}

Latest revision as of 01:27, 19 March 2021

Description

This test case tests that systemd-oomd kills the largest swap consumer when swap used is greater 90% (or whatever limit was defined by systemd-oomd-defaults).

Setup

  • This test case should be performed on either bare-metal or virtual machines.
  • Check that you are running systemd 248~rc4 or higher with systemctl --version.
  • Ensure the systemd-oomd-defaults package is installed (included with Fedora 34).
  • Boot the system and log in as a regular user.
  • Ensure no other conflicting userspace OOM killers are running. For example you may have to stop earlyoom:
sudo systemctl stop earlyoom

How to test

  • Check that systemd-oomd is running:
systemctl status systemd-oomd
  • Check that the systemd-oomd-defaults policy was applied by running oomctl and verifying that "/" is listed as a path under "Swap Monitored CGroups" along with the current swap usage.
  • Now run the test:
systemd-run --user -r --unit systoomd_swap_test tail /dev/zero
  • Make sure to reset the test unit after verifying the results:
systemctl --user reset-failed systoomd_swap_test.service

Expected Results

  • systemd-oomd will have killed the unit started above.
  • You can verify by checking for some of the relevant log lines with journalctl: "Swap used <...> is more than 90%" or "systemd-oomd killed <...> process(es)"
  • The output of systemctl --user status systoomd_swap_test should say the unit is killed. The kill can be racy so you may or may not see "systemd-oomd killed <...> process(es) in this unit". But if you see that message and also mention of "oom-kill" (which means the kernel OOM killer also kicked in) please note that in the comments/results. Otherwise, if it was a systemd-oomd only kill there will be no mention of "oom-kill".
  • Swap used should be below 90% (use free -h)