Zswap is a lightweight compressed cache for swap pages. It takes pages that arein the process of being swapped out and attempts to compress them into adynamically allocatedRAM-based memory pool. zswap basically trades CPU cyclesfor potentially reduced swap I/O. This trade-off can also result in asignificant performance improvement if reads from the compressed cache arefaster than reads from a swap device.

NOTE: Zswap is a new feature as of v3.11 and interacts heavily with memoryreclaim. This interaction has not be fully explored on the large set ofpotential configurations and workloads that exist. For this reason, zswapis a work in progress and should be considered experimental.

Some potential benefits:* Desktop/laptop users with limited RAM capacities can mitigate the performance impact of swapping.* Overcommitted guests that share a common I/O resource can dramatically reduce their swap I/O pressure, avoiding heavy handed I/O throttling by the hypervisor. This allows more work to get done with less impact to the guest workload and guests sharing the I/O subsystem* Users with SSDs as swap devices can extend the life of the device by drastically reducing life-shortening writes.

Zswap evicts pages from compressed cache on an LRU basis to the backing swapdevice when the compressed pool reaches it size limit. This requirement hadbeen identified in prior community discussions.

To enabled zswap, the “enabled” attribute must be set to 1 at boot time. e.g.zswap.enabled=1