I'm using it together with zram sized to 200% RAM size on a low RAM phone with no disk swap (plus some tuning like the mentioned clustering knob) and it works pretty well if you don't mind some otherwise preventable kills, but I will happily switch to diskless zswap once it's ready.
Debunking Zswap and Zram Myths
41–50 of 70 posts
Re: Debunking Zswap and Zram Myths
#42User here, who also acts as a Level 2 support for storage. The article contains some solid logic plus an assumption that I disagree with. Solid logic: you should prefer zswap if you have a device that can be used for swap . Solid logic: zram + other swap = bad due to LRU inversion (zram becomes a dead weight in memory). Advice that matches my observations: zram works best when paired with a user-space OOM killer. Bol…
> Many consumer SSDs ... under synchronous writes, will regularly produce latency spikes of 10 seconds or more Surely "regularly" is a significant overstatement. Most people have practically never seen this failure mode. And if it only occurs under a heavy write workload, that's not something that's supposed to happen purely as a result of swapping.
Re: Debunking Zswap and Zram Myths
#43Would be nice if zswap could be configured to have no backing cache so it could completely replace zram. Having two slightly different systems is weird. There's not really any difference between swap on disk being full and swap in ram being full, either way something needs to get OOM killed. Simplifying the configuration would probably also make it easier to enable by default in most distros. It's kind of backwards t…
> Would be nice if zswap could be configured to have no backing cache You can technically get this behavior today using /dev/ram0 as a swap device, but it's very awkward and almost certainly a bad idea.
Re: Debunking Zswap and Zram Myths
#44With zram, I can just use zram-generator[0] and it does everything for me and I don't even need to set anything up, other than installing the systemd generator, which on some distros, it's installed by default. Is there anything equivalent for zswap? Otherwise, I'm not surprised most people are just using zram, even if sub-optimal. [0]: https://crates.io/crates/zram-generator
Re: Debunking Zswap and Zram Myths
#45Is this advice also applicable to Desktops installations?
On my workstation, I run statistical simulations in R which can be wasteful with memory and cause a lot of transient memory pressure, and for that scenario I do like that zswap works alongside regular swap. Especially when combined with the advice from https://makedebianfunagainandlearnhowtodoothercoolstufftoo.c... to wake up kswapd early, it really does seem to make a difference.
Re: Debunking Zswap and Zram Myths
#46Would be nice if zswap could be configured to have no backing cache so it could completely replace zram. Having two slightly different systems is weird. There's not really any difference between swap on disk being full and swap in ram being full, either way something needs to get OOM killed. Simplifying the configuration would probably also make it easier to enable by default in most distros. It's kind of backwards t…
This is actually something we're actively working on! Nhat Pham is working on a patch series called "virtual swap space" ( https://lwn.net/Articles/1059201/ ) which decouples zswap from its backing store entirely. The goal is to consolidate on a single implementation with proper MM integration rather than maintaining two systems with very different failure modes. It should be out in the next few months, hopefully.
Re: Debunking Zswap and Zram Myths
#47Re: Debunking Zswap and Zram Myths
#48Earlier quoted context omitted.
The better distros have it (ZRAM) enabled by default for desktops (I think PopOS and Fedora). In my personal experience every desktop Linux should use memory compression (except you have an absurd amount of RAM) because it helps so much, especially with everything related to browser and/or electron usage! Windows and macOS have it enabled by default for many years (even if it works a little different there).
I did an Archinstall setup this weekend, and that also suggested zram.
See also the "zram on Fedora" section in the article.
Re: Debunking Zswap and Zram Myths
#49Re: Debunking Zswap and Zram Myths
#50BTW most of zram tutorials get it wrong, you are supposed to manually mark idle pages and initiate writeback by periodically writing to /sys/block/zramX/idle and /sys/block/zramX/writeback . Otherwise zram will never ever write anything to backing device. It is documented in kernel docs, just that if you expect it to work automatically you might misread it.
And you can convert swap into such backing device, but then you don't do swapon on it (just remove it from fstab) nor it's necesary to format(mkswap) it.