From patchwork Thu Oct 27 04:26:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13021579 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A635C38A2D for ; Thu, 27 Oct 2022 04:27:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A33E28E000B; Thu, 27 Oct 2022 00:27:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9BCDB8E0001; Thu, 27 Oct 2022 00:27:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 861038E000B; Thu, 27 Oct 2022 00:27:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 71E5B8E0001 for ; Thu, 27 Oct 2022 00:27:17 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4A6E6141099 for ; Thu, 27 Oct 2022 04:27:17 +0000 (UTC) X-FDA: 80065444914.22.2D92653 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf17.hostedemail.com (Postfix) with ESMTP id E71D940003 for ; Thu, 27 Oct 2022 04:27:16 +0000 (UTC) Received: by mail-pg1-f176.google.com with SMTP id b5so138897pgb.6 for ; Wed, 26 Oct 2022 21:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FfJZOEZUcigJa5MAkTFt0GQw8t62BAN+ikSaaiyKqzg=; b=Ha3HWb3QEL2wAUei2E+xdtM/8MgiD5xkJ2+KGW7ASzNP1x7TN4j0HYIFu+8jGt+wPC RBWYYxFesKjH5fTCLTVjXR7Bh8OmrCWl/XzgyrX5MUGIKV8GVywLF9wAmH7NijSYHVGG QYr7eTqzjKYjJoyp0rodElpITNvzWxYDgPiMA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FfJZOEZUcigJa5MAkTFt0GQw8t62BAN+ikSaaiyKqzg=; b=jifCOUxq4fX+dZNRheyifPtEG27e6EdRLSq5bEMqZBvn6sRzm0MicS/np92VpiY79G USkHRKxrqI6BN1hoKwWuO8vfY3D/n/GbcsFWLfymk/NotpANEZ1Aa2qSLrp9MR1FRbN0 R7xE5GIqdR13jmHixqydFsXN32anNtGOyQkAIWjiLwP2Qg6TQQDfnnD0n2I/Y/wLNOim Y19Jv8yYylVAUuqonHmYjJnPrRyXITPMNQVLrIrVZyLdRbpJALUW/I5glbtq21ojkU0i AyZgDJv3jf/n0ewi5KcXt0UeNJ9QG2leO9K0oGZfBHRX6d9jFJWInxAqx+kt7kaNTTnl xToA== X-Gm-Message-State: ACrzQf28T8IWX6ATLpMAAOlq/PumNZL+rdK/67DuETwtHcYqG8U/AMiY 1uYeIaERc86E0rb8o85/euw2PA== X-Google-Smtp-Source: AMsMyM7ThsUAVtRWF4QYvAYelWAHXIMYiM1JSDHU9HcoznhoEpkt3lbidbLFOWqSQq0TVrKr9qB6Kg== X-Received: by 2002:a05:6a00:150e:b0:56c:83b3:d148 with SMTP id q14-20020a056a00150e00b0056c83b3d148mr3568040pfu.48.1666844836111; Wed, 26 Oct 2022 21:27:16 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:30f2:4501:65fa:df12]) by smtp.gmail.com with ESMTPSA id w23-20020aa79557000000b00565c8634e55sm203140pfq.135.2022.10.26.21.27.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 21:27:15 -0700 (PDT) From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: Nitin Gupta , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sergey Senozhatsky Subject: [PATCHv3 8/9] Documentation: document zram pages_per_pool_page attribute Date: Thu, 27 Oct 2022 13:26:50 +0900 Message-Id: <20221027042651.234524-9-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221027042651.234524-1-senozhatsky@chromium.org> References: <20221027042651.234524-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666844837; a=rsa-sha256; cv=none; b=tXBaiB5YywJzJpAiiiScKB+QpNF9QdyYx6/BXiBJtjZrp66G0KdANgz4hXlo+0RaV3j5mo cXGlc936zwLukz1CitBsSPHT1nnDzdaKcXNEOON9ZExFKohXC3kz3PkjAYA7bnLjXZriI3 1O0WOPIlhvrI6uUsP14pEKOu7kHT70o= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Ha3HWb3Q; spf=pass (imf17.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.215.176 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666844837; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FfJZOEZUcigJa5MAkTFt0GQw8t62BAN+ikSaaiyKqzg=; b=EShjQ7rOJbkrHA1aCBBn+uTN8W+rK03wIz2+Ecs/ycdbPAs/ObimZU4rrBu0vWikCb70na QF3p6ui/Dxe5MHE1ZVp9QGUH9cSj7O8P0I4b4sMhxalwt9+fqYxcnAZy7jvmK7JKd9zywm psRapDxFZNzawq4fiMJ6RcpE2iHlr84= X-Rspamd-Queue-Id: E71D940003 X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Ha3HWb3Q; spf=pass (imf17.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.215.176 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspamd-Server: rspam04 X-Stat-Signature: 37huojcyt4ipjs9z34hmt9891ythydsu X-HE-Tag: 1666844836-759926 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Provide a simple documentation for pages_per_pool_page ZRAM device attribute. Signed-off-by: Sergey Senozhatsky --- Documentation/admin-guide/blockdev/zram.rst | 38 ++++++++++++++++----- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/Documentation/admin-guide/blockdev/zram.rst b/Documentation/admin-guide/blockdev/zram.rst index 010fb05a5999..4cb287520d45 100644 --- a/Documentation/admin-guide/blockdev/zram.rst +++ b/Documentation/admin-guide/blockdev/zram.rst @@ -112,7 +112,29 @@ to list all of them using, for instance, /proc/crypto or any other 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 greater than twice the size of memory 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/ @@ -283,15 +305,15 @@ a single line of text and contains the following stats separated by whitespace: 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::