How To Enable zswap On Linux

zswap is a kernel feature in Linux that provides a compressed RAM cache for swap pages. Pages that would otherwise be swapped out to disk are instead compressed and stored into a memory pool in RAM.

Steps to enable zswap on your server

  1. Verify that swap is enabled. See this doc for steps to enable swap.

  2. Example commands to enable zswap using ths zstd compression algorithm with zsmalloc memory pool allocator and a maximum pool size of 25%. See the docs in the reference section details of each parameter.

    
        # echo zsmalloc > /sys/module/zswap/parameters/zpool
        # echo 25 > /sys/module/zswap/parameters/max_pool_percent
        # echo zstd > /sys/module/zswap/parameters/compressor
        # echo 1 > /sys/module/zswap/parameters/enabled
    

Reference:

Last updated by ObjectiveFS staff, Nov 18, 2025
ObjectiveFS is a shared file system for macOS and Linux that automatically scales and gives you scalable cloud storage. If you have questions or article idea suggestions, please email us at support@objectivefs.com