From Fedora Project Wiki

No edit summary
No edit summary
Line 3: Line 3:


|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~rc1 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.


|actions=
|actions=
# Check that systemd-oomd is running:
* Check that systemd-oomd is running:
<pre>
<pre>
systemctl status systemd-oomd
systemctl status systemd-oomd
</pre>
</pre>
# 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.
* 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:
* Now run the test:
<pre>
<pre>
systemd-run --user --unit systoomd_swap_test tail /dev/zero
systemd-run --user --unit systoomd_swap_test tail /dev/zero
</pre>
* After verifying the results below, reset the unit:
<pre>
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 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).
# Swap used should be below 90% (use `free -h`)
* Swap used should be below 90% (use `free -h`)
}}
}}

Revision as of 11:23, 11 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~rc1 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.

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 --unit systoomd_swap_test tail /dev/zero
  • After verifying the results below, reset the unit:
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 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).
  • Swap used should be below 90% (use free -h)