From patchwork Wed Oct 26 11:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13020482 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 AE792C38A2D for ; Wed, 26 Oct 2022 11:30:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 517B48E000B; Wed, 26 Oct 2022 07:30:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C88E8E0001; Wed, 26 Oct 2022 07:30:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 390118E000B; Wed, 26 Oct 2022 07:30:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2973D8E0001 for ; Wed, 26 Oct 2022 07:30:32 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EE4C41410AA for ; Wed, 26 Oct 2022 11:30:31 +0000 (UTC) X-FDA: 80062882662.06.FB56F45 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf09.hostedemail.com (Postfix) with ESMTP id 90217140016 for ; Wed, 26 Oct 2022 11:30:31 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id p3so12797383pld.10 for ; Wed, 26 Oct 2022 04:30:31 -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=Hk7CS3au15tpcnLWnpgWC0Rnc801I8tY9u+HaqWxqlYNuxpQN/yv0Fy4xMMEg4wiFp P1cmYme01LnaBIZiGnBSDg11RxQ6kx8NOUMHePDUSScdBnB4S+SETARYJdvD2HbhOKXH 71mfQKa3CRGhmyw1+LSbb4hFSYGLyJycxikyA= 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=qPzK/Wc/dusxBVynoo0jD0B9MtAkrYRcaJF8nrbwSYdToY+WgWTTAY7jEjPQWLk2VX x+2tWeO+Q46dKnnuxeNhe19pulwhUMrU070R8PFt6ABtdtO5lwJtBG1dtDV8xtev5eBX 9VIOEU+BMiQ6VdcUeWrcYxLl50oTem8fEcFkEC3nQMEesFCYOgWcN+uVDN9v03N7Wr6z Eb6WgIzQOPElPywRa11wMSqKInqc82wYev4u0roJRzl0gs3dCTfPuED52MGszOSYSjJr YRX5s2tLep5IY8FJhowZGYKLsfhvAtvwmULTM4z670Y1ax/zoFnLqvBjkavn4NGPpKAk D4Ww== X-Gm-Message-State: ACrzQf2qwLbJUlvDr3PsIXi6TMWXkWcFJre89JxmVtqvTbZ8N/YlzFhR 7aN6JjIQJASmbW6tnMsVCslRI5XXiWg9xg== X-Google-Smtp-Source: AMsMyM6pFzr/Nn/uvAjan7oO4hayW5IPIevd8ht+/9uN4dYdxV1aG5KBcN/L1bDFkLxcnNYJrtvF0A== X-Received: by 2002:a17:90b:380b:b0:20b:8dd:4f5f with SMTP id mq11-20020a17090b380b00b0020b08dd4f5fmr3788594pjb.158.1666783830341; Wed, 26 Oct 2022 04:30:30 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:749c:f7f5:1a8e:d0be]) by smtp.gmail.com with ESMTPSA id x127-20020a626385000000b005627868e27esm2814919pfb.127.2022.10.26.04.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 04:30:30 -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: [PATCHv2 8/9] Documentation: document zram pages_per_pool_page attribute Date: Wed, 26 Oct 2022 20:29:32 +0900 Message-Id: <20221026112933.4122957-9-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221026112933.4122957-1-senozhatsky@chromium.org> References: <20221026112933.4122957-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666783831; 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=vbrUtLpczEHvtFTztZ1W78cUFZpgvv9yw+5mzRu/VFunKTBXEnkgAA0BsIl+bsqOF9loMM bUUKbr58CnlT6tRilIBoJnMOHxamaxbzU5LnhIa8IUnQSaQDg4qLQh1ByFDX22N3aIxVJ5 gTX0Ot+otp8ZqdRO04DO4KXNr3drUBc= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Hk7CS3au; spf=pass (imf09.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.172 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666783831; a=rsa-sha256; cv=none; b=c9ocylbihth2NUDs6//fypowmx/EfwDgxQhIE+37679Ydvfqc2qlLpbTTUnxxcUes6NW6L dNs+uAAs8efCCIyD/ggacrffJpg0H2rR4dwINC9TZOHcZbG0BwNSTIk1Q65BSkQ5JqHRMo yveAVZD/xweQzb06MfcZ6ZpUpXckpxU= Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Hk7CS3au; spf=pass (imf09.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.172 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Stat-Signature: zpzsj11dkwueed9thg4ciy6rb797xjyf X-Rspamd-Queue-Id: 90217140016 X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1666783831-300862 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::