Enabling memory compression

I’m still stuck with an older laptop (Acer Aspire 5740G) on which I’m currently also switching from the old openSUSE install to the latest version of Manjaro. It works fine for the most part except for the curse of most laptops: It only has 4 GB of RAM, which is so little the memory fills up just by opening too many tabs in Firefox or doing other trivial tasks.

I remember a few years ago the Linux kernel announced support for memory compression. While I don’t need that on most of my devices I could definitely use it for this laptop. But I never used the feature before and have no idea how to enable it. What’s the correct way to turn on memory compression support in the kernel on Manjaro?

Check out zram and zswap.

https://wiki.archlinux.org/title/Improving_performance#zram_or_zswap

1 Like

Definately checkout :point_up_2:

Please check the value of your system swappiness

cat /proc/sys/vm/swappiness

The systemd default is 60 but I suspect the value has been lowered.

1 Like

Thanks. Seems a bit complicated to configure, was hoping it’s just one kernel parameter or a single option to set it up. Will see if I still need it first.

On a little off-topic note: Manjaro feels a bit faster on my laptop than openSUSE! It could be due to updated packages or doing a fresh install for the first time in years, but I can sense a welcome difference in the end. Without opening extra applications I have 1 GB of the 4 GB of RAM used, that’s pretty good.

1 Like

There is a package in the AUR called zramd,when you install it then just enabled it

sudo systemctl enable --now zramd

It uses the Fedora defaults configurations for zram + zstd compression

Keep in mind,you need to disable zswap,it can create troubles with zram,go to your grub config /etc/default/grub

In the line

GRUB_CMDLINE_LINUX_DEFAULT=

after eveything in there,type

zswap.enabled=0

save,then in the terminal do a

sudo update-grub

then reboot,you should now have a zram ready to go.

2 Likes

I tried simply booting with kernel parameters “zram.enabled=1 zram_enabled=1” as a test: Didn’t seem to make a difference, I take it that didn’t activate it. The rest seems a bit more complicated, will hold off for now… hoping fresh system settings will use less RAM too. Thanks for the help!