The patch titled Subject: Documentation: document zram pages_per_pool_page attribute has been added to the -mm mm-unstable branch. Its filename is documentation-document-zram-pages_per_pool_page-attribute.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/documentation-document-zram-pages_per_pool_page-attribute.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> Subject: Documentation: document zram pages_per_pool_page attribute Date: Mon, 31 Oct 2022 14:41:07 +0900 Provide a simple documentation for pages_per_pool_page ZRAM device attribute. Link: https://lkml.kernel.org/r/20221031054108.541190-9-senozhatsky@xxxxxxxxxxxx Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> Cc: Alexey Romanov <avromanov@xxxxxxxxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Nitin Gupta <ngupta@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/admin-guide/blockdev/zram.rst | 38 ++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) --- a/Documentation/admin-guide/blockdev/zram.rst~documentation-document-zram-pages_per_pool_page-attribute +++ a/Documentation/admin-guide/blockdev/zram.rst @@ -112,7 +112,29 @@ to list all of them using, for instance, method. This, however, has an advantage of permitting the usage of custom crypto compression modules (implementing S/W or H/W compression). -4) Set Disksize +4) Set pages per-pool page limit: Optional +========================================== + +zsmalloc pages can consist of up to ZS_DEFAULT_PAGES_PER_ZSPAGE (single) +physical pages. The exact number is calculated for each zsmalloc size +class during zsmalloc pool creation. ZRAM provides pages_per_pool_page +device attribute that lets one adjust that limit (maximum possible value +is ZS_MAX_PAGES_PER_ZSPAGE). The default limit is considered to be good +enough, so tweak this value only when the changes in zsmalloc size classes +characteristics are beneficial for your data patterns. The limit on the +pages per zspages (currently) should be in [1,16] range; default value +is 4. + +Examples:: + + #show current zsmalloc pages per-pool page limit + cat /sys/block/zramX/pages_per_pool_page + 4 + + #set zsmalloc pages per-pool page limit + echo 8 > /sys/block/zramX/pages_per_pool_page + +5) Set Disksize =============== Set disk size by writing the value to sysfs node 'disksize'. @@ -132,7 +154,7 @@ There is little point creating a zram of since we expect a 2:1 compression ratio. Note that zram uses about 0.1% of the size of the disk when not in use so a huge zram is wasteful. -5) Set memory limit: Optional +6) Set memory limit: Optional ============================= Set memory limit by writing the value to sysfs node 'mem_limit'. @@ -151,7 +173,7 @@ Examples:: # To disable memory limit echo 0 > /sys/block/zram0/mem_limit -6) Activate +7) Activate =========== :: @@ -162,7 +184,7 @@ Examples:: mkfs.ext4 /dev/zram1 mount /dev/zram1 /tmp -7) Add/remove zram devices +8) Add/remove zram devices ========================== zram provides a control interface, which enables dynamic (on-demand) device @@ -182,7 +204,7 @@ execute:: echo X > /sys/class/zram-control/hot_remove -8) Stats +9) Stats ======== Per-device statistics are exported as various nodes under /sys/block/zram<id>/ @@ -283,15 +305,15 @@ a single line of text and contains the f Unit: 4K bytes ============== ============================================================= -9) Deactivate -============= +10) Deactivate +============== :: swapoff /dev/zram0 umount /dev/zram1 -10) Reset +11) Reset ========= Write any positive value to 'reset' sysfs node:: _ Patches currently in -mm which might be from senozhatsky@xxxxxxxxxxxx are zram-preparation-for-multi-zcomp-support.patch zram-add-recompression-algorithm-sysfs-knob.patch zram-factor-out-wb-and-non-wb-zram-read-functions.patch zram-introduce-recompress-sysfs-knob.patch documentation-add-recompression-documentation.patch zram-add-recompression-algorithm-choice-to-kconfig.patch zram-add-recompress-flag-to-read_block_state.patch zram-clarify-writeback_store-comment.patch zram-use-is_err_value-to-check-for-zs_malloc-errors.patch zsmalloc-turn-zspage-order-into-runtime-variable.patch zsmalloc-move-away-from-page-order-defines.patch zsmalloc-make-huge-class-watermark-zs_pool-member.patch zram-huge-size-watermark-cannot-be-global.patch zsmalloc-pass-limit-on-pages-per-zspage-to-zs_create_pool.patch zram-add-pages_per_pool_page-device-attribute.patch documentation-document-zram-pages_per_pool_page-attribute.patch zsmalloc-break-out-of-loop-when-found-perfect-zspage-order.patch