zswap

Source: Wikipedia, the free encyclopedia.

zswap
GNU GPL
Websitekernel.org

zswap is a

CPU cycles to perform the compression.[1][2][3]

As a result of reduced I/O, zswap offers advantages to various devices that use

swap space prevents it from wearing out quickly.[4]

Internals

zswap is integrated into the rest of Linux kernel's

memory pages while they are being swapped out, and capable of intercepting page faults for the already swapped pages; the access to those two paths allows zswap to act as a compressed write-back cache for swapped pages.[1][6]

Internally, zswap uses compression

kernel boot parameter zswap.compressor; if not specified, it selects the Lempel–Ziv–Oberhumer (LZO) compression. As of version 3.13 of the Linux kernel, zswap also needs to be explicitly enabled by specifying value 1 for the kernel boot parameter zswap.enabled.[1][2][4]

The maximum size of the memory pool used by zswap is configurable through the

least recently used (LRU) basis. This approach makes zswap a true swap cache, as the oldest cached pages are evicted to a swap device once the cache is full, making room for newer swapped pages to be compressed and cached.[1][4][7]

zbud is a special-purpose

allocate more memory space than it would be originally occupied by the uncompressed pages.[3][9]

History

Both zswap and zbud were created by Seth Jennings. The first public announcement was in December 2012, and the development continued until May 2013 at which point the codebase reached its maturity although still having the status of an experimental kernel feature.[10][11]

zswap (together with zbud) was merged into the

Linux kernel mainline in kernel version 3.11, which was released on September 2, 2013.[4][12]

Since version 3.15 of the Linux kernel, which was released on June 8, 2014, zswap properly supports multiple swap devices.[13][14]

Alternatives

One of the alternatives to zswap is zram, which provides a similar but still different "swap compressed pages to RAM" mechanism to the Linux kernel.

The main difference is that zram provides a compressed

block device
using RAM for storing data, which acts as a regular and separate swap device.

In comparison, zswap acts as a RAM-based cache for swap devices. This provides zswap with an

eviction mechanism for less used swapped pages, which zram lacked until the introduction of CONFIG_ZRAM_WRITEBACK in kernel version 4.14. Though, as a result of its design, at least one already existing swap device is required for zswap to be used.[15]

See also

References

  1. ^ a b c d Seth Jennings (February 12, 2013). "The zswap compressed swap cache". LWN.net. Retrieved January 22, 2014.
  2. ^ a b Jenifer Hopper (December 11, 2012). "New Linux zswap compression functionality". IBM. Retrieved January 31, 2014.
  3. ^
    Phoronix
    . Retrieved February 5, 2014.
  4. ^ a b c d "Linux kernel documentation: Documentation/vm/zswap.txt". kernel.org. November 22, 2013. Retrieved January 22, 2014.
  5. ^ Dan Magenheimer (April 22, 2010). "Frontswap [PATCH 0/4] (was Transcendent Memory): Overview". gmane.org. Retrieved December 23, 2014.
  6. ^ Jonathan Corbet (May 4, 2010). "Cleancache and Frontswap". LWN.net. Retrieved March 26, 2014.
  7. ^ "Linux kernel source tree: kernel/git/torvalds/linux.git: zswap: add to mm/". kernel.org. July 11, 2013. Retrieved February 5, 2014.
  8. ^ Dan Magenheimer (March 29, 2012). "Zcache and RAMster (oh, and frontswap too): Overview and some benchmarking" (PDF). oss.oracle.com. p. 12. Retrieved August 19, 2015.
  9. ^ "Linux kernel source tree: kernel/git/torvalds/linux.git: zbud: add to mm/". kernel.org. July 11, 2013. Retrieved February 5, 2014.
  10. ^ "[PATCH 0/8] zswap: compressed swap caching". gmane.org. December 11, 2012. Retrieved January 5, 2014.
  11. ^ "[PATCHv10 0/4] zswap: compressed swap caching". gmane.org. May 8, 2013. Retrieved January 5, 2014.
  12. ^ "Linux kernel 3.11, Section 9. Zswap: A compressed swap cache". kernelnewbies.org. September 2, 2013. Retrieved January 22, 2014.
  13. ^ "Linux kernel 3.15, Section 4. Memory management". kernelnewbies.org. June 8, 2014. Retrieved June 15, 2014.
  14. ^ "Linux kernel source tree: kernel/git/torvalds/linux.git: mm/zswap: support multiple swap devices". kernel.org. April 7, 2014. Retrieved June 15, 2014.
  15. ^ Dan Magenheimer (April 3, 2013). "In-kernel memory compression". LWN.net. Retrieved March 8, 2014.


This page is based on the copyrighted Wikipedia article: Zswap. Articles is available under the CC BY-SA 3.0 license; additional terms may apply.Privacy Policy