The patch titled Subject: zswap: update docs for runtime-changeable attributes has been added to the -mm tree. Its filename is zswap-update-docs-for-runtime-changeable-attributes.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/zswap-update-docs-for-runtime-changeable-attributes.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/zswap-update-docs-for-runtime-changeable-attributes.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Dan Streetman <ddstreet@xxxxxxxx> Subject: zswap: update docs for runtime-changeable attributes Change the Documentation/vm/zswap.txt doc to indicate that the "zpool" and "compressor" params are now changeable at runtime. Signed-off-by: Dan Streetman <ddstreet@xxxxxxxx> Cc: Seth Jennings <sjennings@xxxxxxxxxxxxxx> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/vm/zswap.txt | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff -puN Documentation/vm/zswap.txt~zswap-update-docs-for-runtime-changeable-attributes Documentation/vm/zswap.txt --- a/Documentation/vm/zswap.txt~zswap-update-docs-for-runtime-changeable-attributes +++ a/Documentation/vm/zswap.txt @@ -32,7 +32,7 @@ can also be enabled and disabled at runt An example command to enable zswap at runtime, assuming sysfs is mounted at /sys, is: -echo 1 > /sys/modules/zswap/parameters/enabled +echo 1 > /sys/module/zswap/parameters/enabled When zswap is disabled at runtime it will stop storing pages that are being swapped out. However, it will _not_ immediately write out or fault @@ -49,14 +49,27 @@ Zswap receives pages for compression thr evict pages from its own compressed pool on an LRU basis and write them back to the backing swap device in the case that the compressed pool is full. -Zswap makes use of zbud for the managing the compressed memory pool. Each -allocation in zbud is not directly accessible by address. Rather, a handle is +Zswap makes use of zpool for the managing the compressed memory pool. Each +allocation in zpool is not directly accessible by address. Rather, a handle is returned by the allocation routine and that handle must be mapped before being accessed. The compressed memory pool grows on demand and shrinks as compressed -pages are freed. The pool is not preallocated. +pages are freed. The pool is not preallocated. By default, a zpool of type +zbud is created, but it can be selected at boot time by setting the "zpool" +attribute, e.g. zswap.zpool=zbud. It can also be changed at runtime using the +sysfs "zpool" attribute, e.g. + +echo zbud > /sys/module/zswap/parameters/zpool + +The zbud type zpool allocates exactly 1 page to store 2 compressed pages, which +means the compression ratio will always be exactly 2:1 (not including half-full +zbud pages), and any page that compresses to more than 1/2 page in size will be +rejected (and written to the swap disk). The zsmalloc type zpool has a more +complex compressed page storage method, and it can achieve greater storage +densities. However, zsmalloc does not implement compressed page eviction, so +once zswap fills it cannot evict the oldest page, it can only reject new pages. When a swap page is passed from frontswap to zswap, zswap maintains a mapping -of the swap entry, a combination of the swap type and swap offset, to the zbud +of the swap entry, a combination of the swap type and swap offset, to the zpool handle that references that compressed swap page. This mapping is achieved with a red-black tree per swap type. The swap offset is the search key for the tree nodes. @@ -74,9 +87,11 @@ controlled policy: * max_pool_percent - The maximum percentage of memory that the compressed pool can occupy. -Zswap allows the compressor to be selected at kernel boot time by setting the -â??compressorâ?? attribute. The default compressor is lzo. e.g. -zswap.compressor=deflate +The default compressor is lzo, but it can be selected at boot time by setting +the â??compressorâ?? attribute, e.g. zswap.compressor=lzo. It can also be changed +at runtime using the sysfs "compressor" attribute, e.g. + +echo lzo > /sys/module/zswap/parameters/compressor A debugfs interface is provided for various statistic about pool size, number of pages stored, and various counters for the reasons pages are rejected. _ Patches currently in -mm which might be from ddstreet@xxxxxxxx are mm-zpool-constify-the-zpool_ops.patch mm-zbud-constify-the-zbud_ops.patch zpool-add-zpool_has_pool.patch zpool-add-zpool_has_pool-fix.patch zswap-dynamic-pool-creation.patch zswap-dynamic-pool-creation-fix.patch zswap-dynamic-pool-creation-fix-2.patch zswap-change-zpool-compressor-at-runtime.patch zswap-change-zpool-compressor-at-runtime-fix.patch zswap-update-docs-for-runtime-changeable-attributes.patch zpool-remove-no-op-module-init-exit.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html