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

Lennart Poettering lennart at poettering.net
Tue Jun 25 08:55:27 UTC 2019


On Mo, 24.06.19 13:16, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:

> > So for tmpfs mounts that don't turn off DefaultDependencies= we
> > implicit add in an After=swap.target ordering dep. The thinking was
> > that there's no point in swapping in all data of a tmpfs because we
> > want to detach the swap device when we are going to flush it all out
> > right after anyway. This made quite a difference to some folks.
>
> But we add Conflicts=umount.target, Before=umount.target, so we do
> swapoff on all swap devices, which means that swap in the data after all.
> Maybe that's an error, and we should remove this, at least for
> normal swap partitions (not files)?

We never know what kind of weird storage swap might be on, I'd
probably leave that in, as it's really hard to figure out correctly
when leaving swap on would be safe and when not.

Or to say this differently: if people want to micro-optimize that,
they by all means should, but in that case they should probably drop
in their manually crafted .swap unit with DefaultDependencies=no and
all the ordering in place they need, and nothing else. i.e. I believe
this kind of optimization is nothing we need to cater for in the
generic case when swap is configured with /etc/fstab or through GPT
enumeration.

zswap is different: we know exactly that the swap data is located in
RAM, not on complex storage, hence it's entirely safe to not
disassemble it at all, iiuc.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list