Zswap is a feature for the Linux kernel that provides compressed swap caching
. It's been in development for a long time
and was finally merged into the mainline Linux kernel for the 3.11 release.
Making the Linux 3.11 kernel
an even more exciting release was the merger on Wednesday of the Zswap support. Per the Linux kernel documentation, "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."
Among potentially beneficial scenarios are desktop/laptops with limited RAM, overcommitted virtualization guests sharing common I/O resources, and users with SSDs as swap devices can extend their devices life by shortening writes. With the Kconfig ZSWAP
support for Zswap enabled, it's just a matter of setting zswap.enabled=1
as a kernel module parameter.
As part of the Zswap work, Zbud was also added
to the kernel tree for 3.11. Zbud is a special purpose memory allocator for storing compressed pages. This allocator is a rewrite of the Zbud code found in Zcache
The merge to mainline of Zswap happened with this commit
. "Zswap is a thin backend for frontswap that takes pages that are in the process of being swapped out and attempts to compress them and store them in a RAM-based memory pool."