Nowadays zswap is recommended over zram, as it is better at managing what pages get compressed in the RAM, and moving stale pages from the RAM to the disk. I switched from zram to zswap a few days ago after seeing the following article listed in this week’s Web Review, Week 2026-13 - ervin:
I also did some searching on the web before I made the change, and the almost unanimous consensus is that zswap is now the best way to go. Here’s another article from last September:
zswap on my system:
swapon && free -h
NAME TYPE SIZE USED PRIO
/swapfile file 16G 32.2M -1
total used free shared buff/cache available
Mem: 28Gi 6.8Gi 1.5Gi 508Mi 18Gi 21Gi
Swap: 15Gi 32Mi 15Gi
sudo grep -r . /sys/kernel/debug/zswap
[sudo] password for scotty:
/sys/kernel/debug/zswap/stored_incompressible_pages:0
/sys/kernel/debug/zswap/stored_pages:6396
/sys/kernel/debug/zswap/pool_total_size:5160960
/sys/kernel/debug/zswap/written_back_pages:1090
/sys/kernel/debug/zswap/decompress_fail:0
/sys/kernel/debug/zswap/reject_compress_poor:0
/sys/kernel/debug/zswap/reject_compress_fail:0
/sys/kernel/debug/zswap/reject_kmemcache_fail:0
/sys/kernel/debug/zswap/reject_alloc_fail:0
/sys/kernel/debug/zswap/reject_reclaim_fail:0
/sys/kernel/debug/zswap/pool_limit_hit:0