Enable zswap in Linux

If you want to give the zswap kernel extension a try you can enable it just for the current boot with the following

echo 1 > /sys/module/zswap/parameters/enabled

If you want to make the change permanent, it’s simple to do it adding a kernel boot parameter on the grub bootloader

Open the file ‘/etc/default/grub’ and look for a line similar to:


And add ‘zswap.enabled=1’ to the end of it, so it looks something like this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet zswap.enabled=1"

Save the file, update the bootloader with ‘upgrade-grub’ and reboot.

After rebooting you can test if the installation was successful running the following as root:

grep -R . /sys/module/zswap/parameters

Example output:


You’re golden if you see the line:


if it’s enabled successfully.

To look at the stats, and see if it’s making a difference on your RAM usage or not, you should run as root:

grep . /sys/kernel/debug/zswap/*

Example output: