[systemd-devel] swap on zram service unit, using Conflicts=umount

Chris Murphy lists at colorremedies.com
Thu Jun 27 03:06:44 UTC 2019


OK so I'm seeing with systemd.log_level debug at shutdown that there
is a swapoff

[  406.997210] fmac.local systemd[1]: dev-zram0.swap: About to
execute: /sbin/swapoff /dev/zram0
[  406.997844] fmac.local systemd[1]: dev-zram0.swap: Forked
/sbin/swapoff as 1966
[  406.998308] fmac.local systemd[1]: dev-zram0.swap: Changed active
-> deactivating
[  406.998332] fmac.local systemd[1]: Deactivating swap /dev/zram0...
[  406.999489] fmac.local systemd[1966]: dev-zram0.swap: Executing:
/sbin/swapoff /dev/zram0

This happens after /home and /boot/efi are umounted, but before /boot
and / are umounted. This is not unexpected, but I like the idea of no
swapoff at reboot if that's possible. Any system under sufficient
memory and swap pressure could very well have at least delayed
shutdown if systemd shutdown/reboot actually waits for swapoff to exit
successfully.

Is there any interest in a systemd included swap on zram service to
obviate the need for others basically reinventing this wheel? I kinda
put it in the category of fstrim.service and the existing systemd
cryptswap logic. I expect it wouldn't be enabled by default, but
distros can enable or start it as their use cases dictate.


Chris Murphy


More information about the systemd-devel mailing list