It should. The lower the value the less prone is the kernel to swap. You could even set the value to 0 but this doesn’t mean that the kernel will stop swapping. It will only avoid it as much as possible until it is under such a memory shortage so it will swap to prevent OOM condition.
You could set up htop to show zram usage if you want.
Do you mount your partitions with noatime option.
If atime is on the meta data about file accesses it written all the time.
I have it turned off on all my mounts, ssd and hdd.
Each time you run ls or cp etc the block with the inode for that file is updated with the time of access. Given the access time is not that useful unless your backup/archive tools need it you might as well disable.
I did not calculate the amount of data written. I noticed because I had a system doing little useful disk IO but lots of writes.
That indicates you are only using 4G for zram and have an additional 16G swapfile used.
I would disable and remove that swapfile, as well as enabling the default size of zram (8G)
Zram is configured by the settings in /usr/lib/systemd/zram-generator.conf
The default of that file is
# This config file enables a /dev/zram0 device with the default settings:
# — size — same as available RAM or 8GB, whichever is less
# — compression — most likely lzo-rle
#
# To disable, uninstall zram-generator-defaults or create empty
# /etc/systemd/zram-generator.conf file.
[zram0]
zram-size = min(ram, 8192)
If you really really need the swapfile as well as zram then make no changes, but I have a system with 32G RAM and the default zram swap and have never needed to use additional swap.
The ‘free’ command shows the swap usage as well.
$ free
total used free shared buff/cache available
Mem: 32772968 4596488 18304488 81032 10423116 28176480
Swap: 8388604 0 8388604
$ swapon --show
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 8G 0B 100
That’s right. I think I modified the amount of zram some time ago and left it at that.
The swapfile was also created because i wanted to enable hibernation. Something that I haven’t done yet so for the moment it just sits there.
I will though restore zram to 8G as per your advice. Thanks!
You stated in the OP that you have 32G RAM. That swapfile is useless for hibernation since it is only 16G.
I have not done hibernation for several years, but I suspect that the combination of zram and swapfile would present an issue with hibernation. Probably would need to have only the swapfile for that purpose.