Zswap

Zswap is a lightweight compressed cache for swap pages. It takes pages that are in the process of being swapped out and attempts to compress them into a dynamically allocated RAM-based memory pool. Older pages can be evicted to disk making this a sort of write-behind cache. zswap basically trades CPU cycles for potentially reduced swap I/O.

Benefits of usage

* Desktop/laptop users with limited RAM capacities can mitigate the performance impact of swapping.

* Users with SSDs as swap devices can extend the life of the device by drastically reducing life-shortening writes.

Zswap is a work in progress and should be considered experimental.

How to enable/disable Zswap

Zswap is disabled by default but can be enabled at boot time by setting the enabled attribute to 1 at boot time. ie: zswap.enabled=1. Zswap can also be enabled and disabled at runtime using the sysfs interface. An example command to enable zswap at runtime, assuming sysfs is mounted at /sys, is:

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

Alternative

Similar results as with Zswap can be achieved with Zram. Zram though eliminates the need for physical swap device.