3 ms·
With 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,
by prussian 6mo ago
With 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 https://crates.io/crates/zram-generator
- alfanick 6mo agoThis should've been a bash script...
- melvyn2 6mo agoecho 1 > /sys/module/zswap/parameters/enabled It's in TFA.
- prussian 6mo agoenabling != configuring. Are you saying this is all that's necessary, assuming an existing swap device exists? That should be made clearer. Edit: To be extra clear. When I was researching this, I ended up going with zram only because: * It is the default for Fedora. * zramctl gives me live statistics of used and compressed size. * The zswap doc didn't help my confusion on how backing devices work (I guess they're any swapon'd device?)
- deleted 6mo ago[deleted]
- stdbrouw 6mo agoIt doesn't really need any config on most distros, no. That said, if you want it to behave at its best when OOM, it does help to tweak vm.swappiness, vm.watermark_scale_factor, vm.min_free_kbytes, vm.page-cluster and a couple of other parameters. See e.g. https://makedebianfunagainandlearnhowtodoothercoolstufftoo.computer/doku.php?id=start:memmanagement https://makedebianfunagainandlearnhowtodoothercoolstufftoo.c... https://documentation.suse.com/sles/15-SP7/html/SLES-all/cha-tuning-memory.html https://documentation.suse.com/sles/15-SP7/html/SLES-all/cha... I don't know of any good statistics script for zswap, I use the script below as a custom waybar module: #!/bin/bash stored_pages="$(cat /sys/kernel/debug/zswap/stored_pages)" pool_total_size="$(cat /sys/kernel/debug/zswap/pool_total_size)" compressed_size_mib="$((pool_total_size / 1024 / 1024))" compressed_size_gib="$((pool_total_size / 1024 / 1024 / 1024))" compressed_size_mib_remainder="$((compressed_size_mib * 10 / 1024 - compressed_size_gib * 10))" uncompressed_size="$((stored_pages * 4096))" uncompressed_size_mib="$((uncompressed_size / 1024 / 1024))" uncompressed_size_gib="$((uncompressed_size / 1024 / 1024 / 1024))" uncompressed_size_mib_remainder="$((uncompressed_size_mib * 10 / 1024 - uncompressed_size_gib * 10))" ratio="$((100 * uncompressed_size / (pool_total_size + 1)))" echo "$compressed_size_gib.$compressed_size_mib_remainder"
- bilegeek 6mo agoKernel arguments are the primary method: https://wiki.archlinux.org/title/Zswap#Using_kernel_boot_parameters https://wiki.archlinux.org/title/Zswap#Using_kernel_boot_par... Snag: I had issues getting it to use zstd at boot. Not sure if it's a bug or some peculiarity with Debian. Ended up compiling my own kernel for other reasons, and was finally able to get zstd by default, but otherwise I'd have to make/add it to a startup script.
- networked 6mo agoI had the same issue with LZ4. I found a thread about it on the Linux Mint Debian Edition forum and posted my fix there: https://forums.linuxmint.com/viewtopic.php?p=2767087#p2767087 https://forums.linuxmint.com/viewtopic.php?p=2767087#p276708.... In short: add the kernel modules and update GRUB as usual, then install sysfsutils and add the following line at the end of `/etc/sysfs.conf`: module/zswap/parameters/compressor = lz4 # For zstd: #module/zswap/parameters/compressor = zstd Perhaps some kernel change between Linux 6.8 and 6.12 caused the old approach to no longer work.
- deleted 6mo ago[deleted]
- seba_dos1 6mo agoIt's a handy tool, but it doesn't even give you a reasonable zram size by default and doesn't touch other things like page-cluster, so "I don't even need to set anything up" applies only if you don't mind it being quite far from optimal.
- ac29 6mo agoZswap is enabled by default in Arch. Wont do anything without a backing disk swap though