[arch-general] systemd-zram generator

Geo Kozey geokozey at mailfence.com
Mon Jan 13 13:44:38 UTC 2020


> From: Chris Murphy <lists at colorremedies.com>
> Sent: Mon Jan 13 05:51:15 CET 2020
> To: <arch-general at archlinux.org>
> Subject: [arch-general] systemd-zram generator
> 
> 
> Hi,
> 
> swap-create at .service generator for zram devices
> https://github.com/systemd/zram-generator
> 
> zram: Compressed RAM based block devices
> https://www.kernel.org/doc/Documentation/blockdev/zram.txt
> 
> The gist is, if a configuration file exists, a /dev/zram0 device is
> created during early boot and marks it for use by swap.target; so all
> the existing systemd stuff to mkswap and swapon gets used.
> 
> The nice thing is, very low overhead. RAM is not reserved for the
> device, it's only consumed as needed.
> 
> The generator could be installed by default, but without a
> configuration file. In that case, it doesn't create a swap on zram
> device, unless the user creates a configuration file. And at some
> point, the distribution can decide to include a configuration file by
> default.
> 
> I'm thinking a useful yet conservative default would be to create a
> device up to 1:1 with RAM, capping out around 2G-4G. That way small
> RAM devices, like Pi's, get a pretty big zram device. And large RAM
> devices just have a smallish swap for incidental usage.
> 
> One issue (reported upstream in github) is getting priority supported.
> I don't know whether it needs to be configurable, from the config
> file. But it seems sane to have the generator set a high priority, so
> that the zram device is used first, spilling over to a conventional
> swap if the user creates ones.
> 
> This is a project in rust. And I think once some of the issues get
> worked out, it would be great if distributions can converge on this
> implementation.
> 
> Thanks,
> 
> -- 
> Chris Murphy

There are many tools to configure zram available, one is even in Arch Linux repos:
https://www.archlinux.org/packages/community/any/systemd-swap/

I guess when/if systemd-zram generator will be part of systemd then distros will
converge onto it.

Yours sincerely

G. K.


More information about the arch-general mailing list