Hello,
I could get drastic desktop performance improvements on both Pinebook Pro and Raspberry Pi 4 by performing some little tuning, that Manjaro ARM might consider using as defaults ?
Both devices have 4 GB RAM, a bit less being actually available to Linux. That’s not much by nowadays standards.
The default values make an extremely high usage on RAM-compressed swap, which is detrimental to RAM actually available to software, and slow down things to a crawl by constantly swapping/compressing much to much in RAM.
So this can be improved with :
-
Reduce defaut vm.swappiness of “60” to something like 25
This can be achieved by creating an /etc/sysctl.d/99-swappiness.conf containing the line :
vm.swappiness = 25 -
Reduce size of zswap-arm in-RAM compressed swap. It defaults to 150% of RAM size, reducing it to something like 75% seems more reasonable and will ensure more RAM is kept for running programs. 50% might even be better. This should typically be done in the zswap-arm package, otherwise it can be locally done the following way :
– Create a /etc/systemd/scripts directory and copy /usr/lib/systemd/scripts/zswap-arm-ctrl into it
– Edit /etc/systemd/scripts/zswap-arm-ctl and change the value of ZRAM_SIZE_PERCENT to 75, or whatever fits better for you.
– Copy /usr/lib/systemd/system/zswap-arm.service into /etc/systemd/system
– edit /etc/systemd/system/zswap-arm.service so it calls the script from /etc/systemd/scripts instead of /usr/lib/systemd/scripts
– You’re done for this part -
Create a swap partition (better than a swap file, even though it could be) on the machine’s eMMC or SD card.
– This swap file’s purpose is to manage possible overflow from zram swap, but we don’t want to use it as much as possible both for performance considerations and flash memory wear.
– So we list this swap partition in /etc/fstab with the « pri=-1 » option, so it won’t be used unless the zram swap fills up (this one has a priority of 100).
– In this setup, the on-disk swap partition, getting only overflow from ZRAM, wil seldom be used, and if it is, only end up containing swap data wich may never be actually needed again by the system, thus saving RAM without impacting performance or wearing the flash storage.
– I used a 2 GB swap partition on the Raspberry Pi, and a 6 GB swap partition on the Pinebook Pro, in the hope that hibernation to disk migh someday be possible…
Once all this is done, just reboot.
Then check that everything is as expected using the commands :
- sysctl vm.swappiness
- free
- swapon -s
- zramctl
You should enjoy much better system overall response, and you can use the command above after some use of the system, to check how much RAM is used, how much swap and of which kind.
Hope this helps
Here on a quite heavily loaded Pinebook Pro with KDE, Thunderbird open, Vivaldi brower open with more than a dozen tabs, signal-desktop, Dophin open plus some other stuff, I get :
root in /
❯ free -m
total utilisé libre partagé tamp/cache disponible
Mem: 3860 2022 16 1184 1821 614
Partition d’échange: 15149 1635 13513
root in / as
❯ swapon -s
Nom fichier Type Taille Utilisé Priorité
/dev/dm-3 partition 4175868 0 -2
/dev/zram0 partition 2964520 1675776 100
root in / as
❯ zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle 2,8G 1,6G 499M 520,6M 6 [SWAP]
I even consider reducing swappiness and zram swap still a bit more.