logoalt Hacker News

cogman10yesterday at 4:16 PM1 replyview on HN

Yup, you are correct about decompressing before hitting disk.

> Even if you activated zram and disk-backed swap, I'm pretty sure they just get used in parallel, not through some sort of fallback.

You can tweak priorities such that zram ends up being the preferred location for swaps.

However, since it looks like just another block device, what happens is it simply gets filled up with the first swap entries and those in turn aren't written out to the disk device.

zswap works better in that way because it'll keep hotter pages in memory and sends LRU pages to the swap device. That's really the biggest reason to use zswap over zram if you are getting into a situation where you overfill your ram.

zram works best if it's the only device with the expectation that you'll OOME when it fills up.


Replies

yjftsjthsd-hyesterday at 5:38 PM

Okay, that's why we're partially talking past each other: It didn't occur to me that someone would swap to zram and something else. Yes, if disk-backed swap is in play, then zswap is the best option.