PSA: Transitioning from zram+swap to zswap

Since the release of Fedora Asahi Remix, the default configuration for machines with 8GB and 16GB of RAM has been to enable zram along with an 8GB swapfile. We have concluded that this configuration is not effective, and can cause premature out-of-memory conditions (most commonly, oom-killer reports while using Firefox).

Starting now, a fedora-asahi-remix-scripts update will transition systems with swap enabled to use zswap and disable zram. The change will be effective after a reboot. Systems that do not already have a swapfile enabled (using the default config at /var/swap/swapfile) are not affected by this issue, and will continue to use zram only unless a swapfile is manually created (by default, this is the case for 24GB RAM and larger systems).

The new configuration ensures that on-disk swapspace can be fully utilized before the machine reaches an out-of-memory condition. However, due to the different behavior of zswap, the new configuration also reduces the maximum combined memory capacity of the system (RAM+swap) by around 4GB (this applies when zram is not misbehaving - people running into premature OOM situations will still see an improvement despite this). For this reason, new systems will now default to a 12GB swap file (in the next release of the installation images).

Existing systems will not be automatically upgraded to a 12GB swap file. If you want to expand your swap file, you can do so by running sudo /usr/libexec/fedora-asahi-remix-scripts/setup-swap.sh --recreate 12G. You may also change the argument to any desired swapfile size.

There is no change to the defaults for systems with 24GB RAM or more. If you wish to increase your available virtual memory, you may either increase your zram allocation (copy /usr/lib/systemd/zram-generator.conf to /etc/systemd/zram-generator.conf and edit it to set the zram size, which can safely be up to your RAM size) or run sudo /usr/libexec/fedora-asahi-remix-scripts/setup-swap.sh 12G to transition to zswap (replacing 12G with your desired swapfile size).

2 Likes