zswap-cli(1)
β¨ NAME β¨
okay so bestie, welcome to zswap-cli π β it's the command-line tool that lets you control the ZSwap kernel module. that's it, that's the whole vibe. (and yes this is from the General Commands Manual, section 1, iykyk π«Ά)
πΈ SYNOPSIS πΈ
zswap-cli [OPTION...]
π¦ DESCRIPTION π¦
zswap-cli is a command-line tool to control the ZSwap kernel module. literally what it says on the tin, no cap π
π FEATURES π
here's every kernel module option it can handle, and the tea on each one π:
enabledβ value isY(enable) orN(disable) β status: Active β kernel version: Anysame_filled_pages_enabledβ value isY(enable) orN(disable) β status: Deprecated β kernel version: 4.16.0 to 6.10.0max_pool_percentβ value is an integer from1to100β status: Active β kernel version: Anycompressorβ value comes from what's supported by kernel β status: Active β kernel version: Anyzpoolβ value comes from what's supported by kernel β status: Deprecated β kernel version: 3.17.0 to 6.18.0accept_threshold_percentβ value is an integer from1to100β status: Active β kernel version: 5.6.0 or highernon_same_filled_pages_enabledβ value isY(enable) orN(disable) β status: Deprecated β kernel version: 5.18.0 to 6.10.0exclusive_loadsβ value isY(enable) orN(disable) β status: Deprecated β kernel version: 6.5.0 to 6.9.0shrinker_enabledβ value isY(enable) orN(disable) β status: Active β kernel version: 6.8.0 or higher
π¨ Deprecated functionality will be removed in future project versions. so like, don't get attached bestie, it's giving limited-time offer π
π COMMAND-LINE OPTIONS π
every single flag, no skips, we're thorough in this house π«Ά
--helpβ Print help message and exit. π--versionβ Print version information and exit. π·οΈ--configβ Get options from the configuration file instead of the cmdline. π--envβ Get options from the environment variables instead of the cmdline. π±--statsβ Get statistics and current settings of the ZSwap kernel module. π
Supported values:
0(default) β print everything: kernel module settings, usage summary, and debug information.1β print kernel module settings.2β print kernel module usage summary.3β print kernel module debug information.
--verboseβ Enable verbose mode to display additional information for debugging or informational purposes. π-e,--enabledβ Enable or disable the ZSwap kernel module.
Supported values: Y, N.
-s,--same_filled_pages_enabledβ Enable or disable memory pages deduplication.
Supported values: Y, N.
-p,--max_pool_percentβ The maximum percentage of memory that the compressed pool can occupy.
Supported values: integer from 1 to 100.
-c,--compressorβ The algorithm used to compress memory pages.
Supported values: depends on the kernel build time configuration.
-z,--zpoolβ The kernelβs zpool type.
Supported values: depends on the kernel build time configuration.
-a,--accept_threshold_percentβ The threshold at which ZSwap would start accepting pages again after it became full.
Supported values: integer from 1 to 100.
-n,--non_same_filled_pages_enabledβ Enable or disable accepting non same filled memory pages.
Supported values: Y, N.
-x,--exclusive_loadsβ Enable or disable entries invalidation when memory pages are loaded from compressed pool.
Supported values: Y, N.
-r,--shrinker_enabledβ Enable or disable pool shrinking based on memory pressure.
Supported values: Y, N.
π§ ENVIRONMENT OPTIONS π§
zswap-cli support of getting options from the environment variables. yes, it does the env thing β¨
β οΈ Warning! This feature is deprecated and will be removed in future versions. Please consider switching to configuration files or CLI options. fr fr, move on bestie, the config file is right there π
π Supported options
ZSWAP_ENABLED_VALUEβ enable or disable the ZSwap kernel module.ZSWAP_SAME_FILLED_PAGES_ENABLED_VALUEβ enable or disable memory pages deduplication.ZSWAP_MAX_POOL_PERCENT_VALUEβ the maximum percentage of memory that the compressed pool can occupy.ZSWAP_COMPRESSOR_VALUEβ the algorithm used to compress memory pages.ZSWAP_ZPOOL_VALUEβ the kernelβs zpool type.ZSWAP_ACCEPT_THRESHOLD_PERCENT_VALUEβ the threshold at which ZSwap would start accepting pages again after it became full.ZSWAP_NON_SAME_FILLED_PAGES_ENABLED_VALUEβ enable or disable accepting non same filled memory pages.ZSWAP_EXCLUSIVE_LOADS_VALUEβ enable or disable entries invalidation when memory pages are loaded from compressed pool.ZSWAP_SHRINKER_ENABLED_VALUEβ enable or disable pool shrinking based on memory pressure.
π Forwarding options
Export the environment variables using the export command:
export ZSWAP_ENABLED_VALUE=Y
export ZSWAP_SAME_FILLED_PAGES_ENABLED_VALUE=Y
export ZSWAP_MAX_POOL_PERCENT_VALUE=60
export ZSWAP_COMPRESSOR_VALUE=lzo
export ZSWAP_ZPOOL_VALUE=zsmalloc
export ZSWAP_ACCEPT_THRESHOLD_PERCENT_VALUE=90
export ZSWAP_NON_SAME_FILLED_PAGES_ENABLED_VALUE=Y
export ZSWAP_EXCLUSIVE_LOADS_VALUE=Y
export ZSWAP_SHRINKER_ENABLED_VALUE=Y
Start the application with the --env command-line argument:
sudo zswap-cli --env
Note that most distributions are configured by default not to pass user-defined ENV settings when using sudo. In such cases, you can explicitly specify them all in one command:
sudo ZSWAP_ENABLED_VALUE=Y \
ZSWAP_SAME_FILLED_PAGES_ENABLED_VALUE=Y \
ZSWAP_MAX_POOL_PERCENT_VALUE=60 \
ZSWAP_COMPRESSOR_VALUE=lzo \
ZSWAP_ZPOOL_VALUE=zsmalloc \
ZSWAP_ACCEPT_THRESHOLD_PERCENT_VALUE=90 \
ZSWAP_NON_SAME_FILLED_PAGES_ENABLED_VALUE=Y \
ZSWAP_EXCLUSIVE_LOADS_VALUE=Y \
ZSWAP_SHRINKER_ENABLED_VALUE=Y \
zswap-cli --env
π CONFIGURATION FILES π
zswap-cli support of getting options from the configuration files. this is the main character way to do it π
π Supported options
enabledβ enable or disable the ZSwap kernel module.same_filled_pages_enabledβ enable or disable memory pages deduplication.max_pool_percentβ the maximum percentage of memory that the compressed pool can occupy.compressorβ the algorithm used to compress memory pages.zpoolβ the kernelβs zpool type.accept_threshold_percentβ the threshold at which ZSwap would start accepting pages again after it became full.non_same_filled_pages_enabledβ enable or disable accepting non same filled memory pages.exclusive_loadsβ enable or disable entries invalidation when memory pages are loaded from compressed pool.shrinker_enabledβ enable or disable pool shrinking based on memory pressure.
π Forwarding options
Create a configuration file:
[zswap]
enabled=Y
same_filled_pages_enabled=Y
max_pool_percent=60
compressor=lzo
zpool=zsmalloc
accept_threshold_percent=90
non_same_filled_pages_enabled=Y
exclusive_loads=Y
shrinker_enabled=Y
Start the application with the --config command-line argument:
sudo zswap-cli --config /path/to/zswap-cli.conf
π₯ SYSTEMD UNIT π₯
After installation, the systemd unit zswap-cli.service will be added. it's iconic like that π
π οΈ Changing settings
All settings are stored in the /etc/zswap-cli/zswap-cli.conf configuration file. It uses standard key-value syntax and can be edited by the user.
β Enabling unit
Enable the systemd unit to allow it to run at system startup:
sudo systemctl enable --now zswap-cli.service
π« Disabling unit
Disable the systemd unit and stop it from running at system startup:
sudo systemctl disable zswap-cli.service
βΆοΈ Running unit
It is also possible to start the systemd unit without adding it to startup.
Start the unit and enable ZSwap:
sudo systemctl start zswap-cli.service
Stop the unit and disable ZSwap:
sudo systemctl stop zswap-cli.service
β EXIT STATUS β
0: Successful exit. π ate, no crumbs1: An error occurred. π not the vibe
π AUTHORS π
Copyright (c) 2020-2026 EasyCoding Team and contributors.
and that's the whole page bestie π«Ά you just read zswap-cli(1), the General Commands Manual moment of all time. go forth and compress your memory pages, periodt πβ¨
π¦ where this page comes from
- fedora 43: zswap-cli 1.2.0-1.fc43 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms