To add some nuance to this, do not use ZRAM in combination with swap. There’s ZSWAP for that which does what you would expect, without clogging up your RAM and gracefully handling a backing device. (ZRAM is just another block device for the kernel, so you will get LRU inversion if it fills up and you have another layer of swap on disk. Meaning your cold pages will be in needlessly stuck zram.)
To add some nuance to this, do not use ZRAM in combination with swap. There’s ZSWAP for that which does what you would expect, without clogging up your RAM and gracefully handling a backing device. (ZRAM is just another block device for the kernel, so you will get LRU inversion if it fills up and you have another layer of swap on disk. Meaning your cold pages will be in needlessly stuck zram.)
Yeah, the same person who wrote the article I linked above also wrote one on zram vs zswap, which I think is also a good read: https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html