The zswap documentation says:

Zswap seeks to be simple in its policies.  Sysfs attributes allow for one user
controlled policy:
* max_pool_percent - The maximum percentage of memory that the compressed
    pool can occupy.

This specifies the maximum percentage of memory the compressed pool can occupy.

How do I find out:

  • The current percentage of memory occupied by the compressed pool
  • How much of this pool is in use
  • Compression ratios, hit rates, and other useful info

Current statistics:

# grep -R . /sys/kernel/debug/zswap/

Compression ratio:

# cd /sys/kernel/debug/zswap
# perl -E  "say $(cat stored_pages) * 4096 / $(cat pool_total_size)"

Current settings:

$ grep -R . /sys/module/zswap
  • Excellent, thanks! Do you have a source for your 4096 magic number? Welcome to Unix.SE! – Tom Hale Dec 25 '17 at 4:46
  • FYI, I'm not marking this as the answer as I don't see it addressing the first two bullet points. – Tom Hale Dec 25 '17 at 4:58
  • 4096 is the size of the normal memory pages. Modern CPUs are supporting pages larger than 4k, called huge pages, but those are not swap-able. – Mircea Vutcovici Jun 7 '18 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.