Ubuntu: Changes provide better performance on the Raspberry PiJanuary 15, 2022
The desktop version of Ubuntu will soon run much better on the Raspberry PI 4 with 2GB. Canonical has now announced that the upcoming version Ubuntu 22.04 LTS will be optimized for this with the help of the kernel feature “zswap”.
What is zswap?
To answer this question, we need to talk about swap files in general.
If you are running any kind of Linux system, it is very likely (and recommended) that you have a swap file allocated on your hard disk or SD card. Swap files act as a kind of overflow for your memory, caching pages that are rarely used to free up memory for more active processes. This allows you to continue working even when your system is using almost all of its memory. However, using swap files is less powerful than using RAM because accessing your hard drive (or SD card) is slower.
Okay, so where does zswap come in? Zswap is essentially a compression tool. When a process needs to be moved to the swap file, zswap compresses it and checks if the new, smaller size still needs to be moved or if it can stay in RAM. Decompressing a “zswapped” page is much faster than accessing the swap file, so this is a great way to get more bang for your buck on systems with less RAM.
Since zswap is supported out of the box, it can be enabled with the following command:
$ sudo sed -i -e 's/$/ zswap.enabled=1/' /boot/firmware/cmdline.txt