Differences between revisions 1 and 2
Revision 1 as of 2022-07-15 05:57:55
Size: 1118
Editor: ?JohnEod
Comment:
Revision 2 as of 2022-07-15 06:52:13
Size: 1254
Editor: ?JohnEod
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
'''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. '''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.
Line 21: Line 21:
Similar results as with Zswap can be achieved with '''[[https://wiki.debian.org/ZRam|Zram]]''' Similar results as with Zswap can be achieved with '''[[https://wiki.debian.org/ZRam|Zram]]'''. Zram though eliminates the need for physical swap device.

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.