Zswap

From ArchWiki
Revision as of 09:58, 29 May 2014 by OneOfOne (talk | contribs) (A bit of formatting and added instructions for using lz4.)
Jump to navigation Jump to search

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Grammar. (Discuss in Talk:Zswap#)

"Zswap is a Linux kernel feature providing a compressed write-back cache for swapped pages. Instead of moving memory pages to a swap device when they are to be swapped out, zswap performs their compression and then stores them into a memory pool dynamically allocated inside system's RAM." - Wikipedia

In simple words, zswap - no swap as zram(compcache) or swap file/partition. Zswap only interlayer, for work this feature you need manually setup swap partition/file.

Get in work

For enable zswap, add to kernel boot options (line) this

  zswap.enabled=1

Customize the maximum allowed size

  zswap.max_pool_percent=25

Changing the compression algorithm

  zswap.compressor=lzo #deflate #lz4

Enable LZ4 compression (faster than lzo and deflate, less compression)

  1. Add lz4 lz4_compress to the Mkinitcpio#MODULES array.
  2. Rerun mkinitcpio.
  3. Add zswap.compressor=lz4 to your kernel parameters Kernel_parameters#Configuration.
  4. Reboot
  5. Check dmesg :
   $ dmesg | grep 'zswap.* compressor'
   [    0.307223] zswap: using lz4 compressor

See also