As per this answer:
zswap is a swap-specific, compressed, RAM-based "pre-cache". zswap requires a separate swap device.
zram is a compressed, RAM-based block device (that can be used for swap).
I recommend against using both together. If you don't have disk-based swap, use only zram.
If you use both zswap and zram, I suspect the following will happen:
- When a page is swapped out, the page will be sent to
zswap.
zswap will compress the page.
- If the page compresses well,
zswap will store the page.
- If the page compresses poorly,
zswap will send the original (uncompressed) page to zram.
zram will compress the page.
zram will store the page.
In other words, some pages will be redundantly compressed twice. This will result in wasted CPU cycles.
Since both zswap and zram store compressed pages in RAM, there is no advantage to using both.
Also, since zram is not a "pre-cache", using zram with other swap devices will be less performant than using zswap (at least in certain situations as explained here).