Menu Close
Settings Close

Language and Page Formatting Options

Red Hat Training

A Red Hat training course is available for RHEL 8

Chapter 21. Improving system performance with zswap

You can improve system performance by enabling the zswap kernel feature.

21.1. What is zswap

This section explains what zswap is and how it can lead to system performance improvement.

zswap is a kernel feature that provides a compressed RAM cache for swap pages. The mechanism works as follows: zswap takes pages that are in the process of being swapped out and attempts to compress them into a dynamically allocated RAM-based memory pool. When the pool becomes full or the RAM becomes exhausted, zswap evicts pages from compressed cache on an LRU basis (least recently used) to the backing swap device. After the page has been decompressed into the swap cache, zswap frees the compressed version in the pool.

The benefits of zswap
  • significant I/O reduction
  • significant improvement of workload performance

In Red Hat Enterprise Linux 8, zswap is enabled by default.

Additional resources

21.2. Enabling zswap at runtime

You can enable the zswap feature at system runtime using the sysfs interface.


  • You have root permissions.


  • Enable zswap:

    # echo 1 > /sys/module/zswap/parameters/enabled

Verification step

  • Verify that zswap is enabled:

    # grep -r . /sys/kernel/debug/zswap
    pool_total_size:6184960 (pool size in total in pages)
    stored_pages:4251 (pool size after compression)

Additional resources

21.3. Enabling zswap permanently

You can enable the zswap feature permanently by providing the zswap.enabled=1 kernel command-line parameter.


  • You have root permissions.
  • The grubby or zipl utility is installed on your system.


  1. Enable zswap permanently:

    # grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="zswap.enabled=1"
  2. Reboot the system for the changes to take effect.

Verification steps

  • Verify that zswap is enabled:

    # cat /proc/cmdline
    root=/dev/mapper/rhel-root ro crashkernel=auto
    resume=/dev/mapper/rhel-swap rhgb quiet