zswap – compcache, compressed swap for better performance

First, here is a link to article on compcache.


zswap is already in the kernel and you can see the documentation in the kernel documentation. Here is the name of the file if you need:

/usr/share/doc/kernel-doc-$(uname -r)/Documentation/vm/zswap.txt

Here is the overview, in case you do not want to install kernel-doc


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.  zswap basically trades CPU cycles
for potentially reduced swap I/O.  This trade-off can also result in a
significant performance improvement if reads from the compressed cache are
faster than reads from a swap device.

NOTE: Zswap is a new feature as of v3.11 and interacts heavily with memory
reclaim.  This interaction has not be fully explored on the large set of
potential configurations and workloads that exist.  For this reason, zswap
is 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 swap
device when the compressed pool reaches it size limit.  This requirement had
been identified in prior community discussions.

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


Enhanced by Zemanta

About Amit Agarwal