Raspberry Pi Performance: Add ZRAM and these Kernel Parameters

Originally published at: Raspberry Pi Performance: Add ZRAM and these Kernel Parameters

A couple of weeks ago, I published a Pinebook Pro review article on this blog. Similar to the Pinebook Pro, the Raspberry Pi and, more recently, the Raspberry Pi 4 are also ARM-based. I’ve applied some of the optimizations mentioned in that previous article to the Raspberry Pi 4, with good results. I wanted to…

2 Likes

I have added this to Pi 3 and Pi 4 devices and this just makes the user experience more snappy. It helps when you are doing desktop browsing and also helps when you are running services such as Plex for media serving.

Recommended

1 Like

Welcome to the community forums and thanks for taking the time to confirm results with your setups.

Ubuntu 22.04 is supposed to have zswap correctly enabled but it is missing the configuration to enable the kernel modules specifically for (. I sent in the bug report 2 months ago and there is a work around!

Into Bash/Fish/ZSH:

$ sudo -i
$ echo zstd >> /etc/initramfs-tools/modules
$ echo z3fold >> /etc/initramfs-tools/modules
$ update-initramfs -u

Then reboot, and you should now have the real-time zstd compression algorithm and the z3fold pool for zswap as well. ZSwap could be benificial for the Pi due to the speed overheads of the MicroSD card and so compression of data on the card could theoretically mean data can be loaded “faster” in which I’m referring to the fact that data can be read from the MicroSD and decompressed.

The bug I submitted is at Bug #1977764 “kernel modules “zstd” and “z3fold” missing.” : Bugs : ubuntu-settings package : Ubuntu

1 Like

Kudos. Thanks for adding this! I’m also soon to upgrade to 22.04 LTS.

Thank you for that great article!

I’ve first used the version included in the zram-tools package from the repository (I normally prefer software managed by package managers), but that one will only work if you don’t use any other zram devices that are started before the zramswap, because it uses hardcore zram0.

After switching to the github version it works well together with other zram usages.

My use-case how I ran into that problem is log2ram with enabled compression = zram disks (which I want to use to prevent wearing out my sd card too fast)