Possible to use zswap?

I know that there's a package to enable zram-swap, but is it possible to instead use zswap (along with a swap file on USB)?

Okay, it seems that enabling zswap is as easy as doing "echo 1 > /sys/module/zswap/parameters/enabled" but that results in an error message that the directory does not exist. Does this mean that zswap is not enabled in the LEDE kernel?

It is not included in the LEDE kernel.

Personally I have mixed experience with compressed ram schemes, both zwap or the compressed memory feature in macos (similar to zswap) seem to generally improve te average use case, but will make things worse in cases of extreme memory exhaustion. With a router with little memory to start with, I believe the extreme scenarois are way more likely than with a 16GB computer...

Thanks for confirming that for me. It also appears that there is not a separate zswap kernel module that can be installed, so I guess the answer to my original question is "no."

Yeah, I'm wondering about that too. Have been using zram (with 32MB RAM) but I'm now testing just using swap on USB, without zram. Oddly, I seem to have less available ram now, without zram-swap. I do now have a bunch of packages installed to support USB storage; I thought that they'd only consume flash memory, but I suppose that they also have a ram memory footprint?

It's possible to build Openwrt with a zswap-enabled kernel.
Enabling zswap in the kernel requires the following changes to target/linux/generic/config-4.14:


and also in OpenWrt Configuration, choose kmod-lib-lz4 package.

Then put the following commands into the startup script or create an init.d script.

echo lz4 > /sys/module/zswap/parameters/compressor
echo z3fold > /sys/module/zswap/parameters/zpool
echo 20 > /sys/module/zswap/parameters/max_pool_percent
echo 1 > /sys/module/zswap/parameters/enabled
swapon /dev/mmcblk0p1

Replace /dev/mmcblk0p1 with your swap partition or file.
I guess zswap could slightly improve the network performance of your router when there is little free memory (e.g. higher DNS lookup performance).