Zram-generator configuration for low-RAM ARM devices

Does anyone have a good configuration they could share for low-memory (~4GB) ARM devices, such as the Pinebook Pro or RPi4b? So far, I have this, which seems to be working, although it doesn’t seem to get used:

cat /etc/systemd/zram-generator.conf
zram-size = ram
compression-algorithm = zstd
swap-priority = 100

This might be the thing to look at first. I assume free is showing the ZRAM swap active? What happens to the values when you start to use more RAM, e.g. load Firefox and a number of tabs?

Hmm… maybe it is working. Just seems to start using swap quite late on. With several Firefox tabs open:

free -m
               total        used        free      shared  buff/cache   available
Mem:            3862        2409         322         835        1131         549
Swap:           3861         910        2951
1 Like

That looks fine. If you want to push it to use swap faster then you can tweak vm.swappiness, e.g. I run vm.swappiness=133 (because ZRAM is faster than disk swap). However, I don’t think it actually makes any difference in general use when it gets used - it provides extra capacity when it’s needed, and it’s probably pointless swapping out inactive pages out before then.

1 Like

That seems to be a nice balance. My Pinebook Pro now uses swap a bit earlier than when it’s just about to run out of RAM. I was finding that the previous unwillingness to use swap was making it unstable.

1 Like

Can vm.swappiness be set to a value > 100?

Yes. As of several kernel versions ago, it’s not a percentage.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.