zswap-cli(1)

πŸ“¦
version 1.2.0 Β· 5 versions
, in fedora 43

✨ 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 is Y (enable) or N (disable) β€” status: Active β€” kernel version: Any
  • same_filled_pages_enabled β€” value is Y (enable) or N (disable) β€” status: Deprecated β€” kernel version: 4.16.0 to 6.10.0
  • max_pool_percent β€” value is an integer from 1 to 100 β€” status: Active β€” kernel version: Any
  • compressor β€” value comes from what's supported by kernel β€” status: Active β€” kernel version: Any
  • zpool β€” value comes from what's supported by kernel β€” status: Deprecated β€” kernel version: 3.17.0 to 6.18.0
  • accept_threshold_percent β€” value is an integer from 1 to 100 β€” status: Active β€” kernel version: 5.6.0 or higher
  • non_same_filled_pages_enabled β€” value is Y (enable) or N (disable) β€” status: Deprecated β€” kernel version: 5.18.0 to 6.10.0
  • exclusive_loads β€” value is Y (enable) or N (disable) β€” status: Deprecated β€” kernel version: 6.5.0 to 6.9.0
  • shrinker_enabled β€” value is Y (enable) or N (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 crumbs
  • 1: 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