edit: I decreased swappiness and increased vfs cache pressure to reduce the amount of swapping in general.
I’m noticing that a very intended behavior of Zswap is to write pages to disk when they don’t cleanly compress (or for some other reason). How can I configure it to act kind of like Zram but only writeback when the system is actually out of RAM?
grep -R . /sys/kernel/debug/zswap/
/sys/kernel/debug/zswap/stored_incompressible_pages:8224
/sys/kernel/debug/zswap/stored_pages:218538
/sys/kernel/debug/zswap/pool_total_size:229318656
/sys/kernel/debug/zswap/written_back_pages:251371
/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
My parameters: zswap.enabled=1 zswap.compressor=zstd zswap.shrinker_enabled=0 zswap.max_pool_percent=20. Swappiness is at default value.
I don’t think Zswap can be tuned like that.
The idea is that the Linux kernel wants to get rid of this page of memory only because it has something better to use that memory for. So if it’s uncompressible then it should go to swapfile for optimal performance. Otherwise it means something else is getting kicked to swapfile, and it wasn’t the kernel’s first choice to be moved to swap so that’s even worse, and what happens if that is also uncompressible? Now you’ve got a cascading failure.
Define ‘actually out of ram’. If it is writing to swap then it is out of ram. That ram might not all be used by application memory, it could be used by the filesystem cache. Both are important for performance of applications. If you only favour application memory then it it will constantly dump files it has recently read and might be still required by applications rather then dropping some unused application memory instead.
I’m referring to available memory, which still had a few GB left. So what you’re saying is that it might flush buffer/cache to swap, in which case, wouldn’t it make more sense to just drop those instead of writing it to swap since it’s the same I/O consideration?Nvrmind I misunderstood



