diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-10 21:19:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-10 21:19:42 -0400 |
commit | 33e247c7e58d335d70ecb84fd869091e2e4b8dcb (patch) | |
tree | e8561e1993dff03f8e56d10a5795fe9d379a3390 /Documentation/vm/zswap.txt | |
parent | d71fc239b6915a8b750e9a447311029ff45b6580 (diff) | |
parent | 452e06af1f0149b01201f94264d452cd7a95db7a (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge third patch-bomb from Andrew Morton:
- even more of the rest of MM
- lib/ updates
- checkpatch updates
- small changes to a few scruffy filesystems
- kmod fixes/cleanups
- kexec updates
- a dma-mapping cleanup series from hch
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (81 commits)
dma-mapping: consolidate dma_set_mask
dma-mapping: consolidate dma_supported
dma-mapping: cosolidate dma_mapping_error
dma-mapping: consolidate dma_{alloc,free}_noncoherent
dma-mapping: consolidate dma_{alloc,free}_{attrs,coherent}
mm: use vma_is_anonymous() in create_huge_pmd() and wp_huge_pmd()
mm: make sure all file VMAs have ->vm_ops set
mm, mpx: add "vm_flags_t vm_flags" arg to do_mmap_pgoff()
mm: mark most vm_operations_struct const
namei: fix warning while make xmldocs caused by namei.c
ipc: convert invalid scenarios to use WARN_ON
zlib_deflate/deftree: remove bi_reverse()
lib/decompress_unlzma: Do a NULL check for pointer
lib/decompressors: use real out buf size for gunzip with kernel
fs/affs: make root lookup from blkdev logical size
sysctl: fix int -> unsigned long assignments in INT_MIN case
kexec: export KERNEL_IMAGE_SIZE to vmcoreinfo
kexec: align crash_notes allocation to make it be inside one physical page
kexec: remove unnecessary test in kimage_alloc_crash_control_pages()
kexec: split kexec_load syscall from kexec core code
...
Diffstat (limited to 'Documentation/vm/zswap.txt')
-rw-r--r-- | Documentation/vm/zswap.txt | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/Documentation/vm/zswap.txt b/Documentation/vm/zswap.txt index 8458c0861e4e..89fff7d611cc 100644 --- a/Documentation/vm/zswap.txt +++ b/Documentation/vm/zswap.txt | |||
@@ -32,7 +32,7 @@ can also be enabled and disabled at runtime using the sysfs interface. | |||
32 | An example command to enable zswap at runtime, assuming sysfs is mounted | 32 | An example command to enable zswap at runtime, assuming sysfs is mounted |
33 | at /sys, is: | 33 | at /sys, is: |
34 | 34 | ||
35 | echo 1 > /sys/modules/zswap/parameters/enabled | 35 | echo 1 > /sys/module/zswap/parameters/enabled |
36 | 36 | ||
37 | When zswap is disabled at runtime it will stop storing pages that are | 37 | When zswap is disabled at runtime it will stop storing pages that are |
38 | being swapped out. However, it will _not_ immediately write out or fault | 38 | being swapped out. However, it will _not_ immediately write out or fault |
@@ -49,14 +49,26 @@ Zswap receives pages for compression through the Frontswap API and is able to | |||
49 | evict pages from its own compressed pool on an LRU basis and write them back to | 49 | evict pages from its own compressed pool on an LRU basis and write them back to |
50 | the backing swap device in the case that the compressed pool is full. | 50 | the backing swap device in the case that the compressed pool is full. |
51 | 51 | ||
52 | Zswap makes use of zbud for the managing the compressed memory pool. Each | 52 | Zswap makes use of zpool for the managing the compressed memory pool. Each |
53 | allocation in zbud is not directly accessible by address. Rather, a handle is | 53 | allocation in zpool is not directly accessible by address. Rather, a handle is |
54 | returned by the allocation routine and that handle must be mapped before being | 54 | returned by the allocation routine and that handle must be mapped before being |
55 | accessed. The compressed memory pool grows on demand and shrinks as compressed | 55 | accessed. The compressed memory pool grows on demand and shrinks as compressed |
56 | pages are freed. The pool is not preallocated. | 56 | pages are freed. The pool is not preallocated. By default, a zpool of type |
57 | zbud is created, but it can be selected at boot time by setting the "zpool" | ||
58 | attribute, e.g. zswap.zpool=zbud. It can also be changed at runtime using the | ||
59 | sysfs "zpool" attribute, e.g. | ||
60 | |||
61 | echo zbud > /sys/module/zswap/parameters/zpool | ||
62 | |||
63 | The zbud type zpool allocates exactly 1 page to store 2 compressed pages, which | ||
64 | means the compression ratio will always be 2:1 or worse (because of half-full | ||
65 | zbud pages). The zsmalloc type zpool has a more complex compressed page | ||
66 | storage method, and it can achieve greater storage densities. However, | ||
67 | zsmalloc does not implement compressed page eviction, so once zswap fills it | ||
68 | cannot evict the oldest page, it can only reject new pages. | ||
57 | 69 | ||
58 | When a swap page is passed from frontswap to zswap, zswap maintains a mapping | 70 | When a swap page is passed from frontswap to zswap, zswap maintains a mapping |
59 | of the swap entry, a combination of the swap type and swap offset, to the zbud | 71 | of the swap entry, a combination of the swap type and swap offset, to the zpool |
60 | handle that references that compressed swap page. This mapping is achieved | 72 | handle that references that compressed swap page. This mapping is achieved |
61 | with a red-black tree per swap type. The swap offset is the search key for the | 73 | with a red-black tree per swap type. The swap offset is the search key for the |
62 | tree nodes. | 74 | tree nodes. |
@@ -74,9 +86,17 @@ controlled policy: | |||
74 | * max_pool_percent - The maximum percentage of memory that the compressed | 86 | * max_pool_percent - The maximum percentage of memory that the compressed |
75 | pool can occupy. | 87 | pool can occupy. |
76 | 88 | ||
77 | Zswap allows the compressor to be selected at kernel boot time by setting the | 89 | The default compressor is lzo, but it can be selected at boot time by setting |
78 | “compressor” attribute. The default compressor is lzo. e.g. | 90 | the “compressor” attribute, e.g. zswap.compressor=lzo. It can also be changed |
79 | zswap.compressor=deflate | 91 | at runtime using the sysfs "compressor" attribute, e.g. |
92 | |||
93 | echo lzo > /sys/module/zswap/parameters/compressor | ||
94 | |||
95 | When the zpool and/or compressor parameter is changed at runtime, any existing | ||
96 | compressed pages are not modified; they are left in their own zpool. When a | ||
97 | request is made for a page in an old zpool, it is uncompressed using its | ||
98 | original compressor. Once all pages are removed from an old zpool, the zpool | ||
99 | and its compressor are freed. | ||
80 | 100 | ||
81 | A debugfs interface is provided for various statistic about pool size, number | 101 | A debugfs interface is provided for various statistic about pool size, number |
82 | of pages stored, and various counters for the reasons pages are rejected. | 102 | of pages stored, and various counters for the reasons pages are rejected. |