Differences between revisions 3 and 5 (spanning 2 versions)
Revision 3 as of 2022-09-19 13:27:19
Size: 1193
Comment: zswap left experimental phase long ago
Revision 5 as of 2022-09-20 02:32:58
Size: 1177
Editor: PaulWise
Comment: formatting
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
* Desktop, laptop, mobile 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.
 * Systems with limited RAM capacities can have the performance impact of swapping mitigated.
 * Systems with SSDs as swap devices can extend the life of the device by drastically reducing life-shortening writes.
Line 15: Line 14:
{{{ echo 1 > /sys/module/zswap/parameters/enabled }}} {{{echo 1 > /sys/module/zswap/parameters/enabled}}}

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

  • Systems with limited RAM capacities can have the performance impact of swapping mitigated.
  • Systems with SSDs as swap devices can extend the life of the device by drastically reducing life-shortening writes.

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.