From patchwork Mon Oct 31 05:41:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13025397 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 0136CC38A02 for ; Mon, 31 Oct 2022 05:41:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 920C68000A; Mon, 31 Oct 2022 01:41:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D14480007; Mon, 31 Oct 2022 01:41:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74A758000A; Mon, 31 Oct 2022 01:41:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4DA3480007 for ; Mon, 31 Oct 2022 01:41:39 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E66F38094C for ; Mon, 31 Oct 2022 05:41:38 +0000 (UTC) X-FDA: 80080147476.20.81F91E0 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf22.hostedemail.com (Postfix) with ESMTP id 906F7C0004 for ; Mon, 31 Oct 2022 05:41:38 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id g24so9837385plq.3 for ; Sun, 30 Oct 2022 22:41:38 -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=qzo+UO6rKhGS8H3i9OK87Ngl18bf6HViCqWtuB03u/E=; b=QRDjYTAa+Msioavw2AlKW7FO+YjBklxX0gbCjIerT/q6sgi8l09+WqL5NncXeQx8HR PnpF5DB5BqOsiTGvYpsH7rM3Fl8J6lOQwfY44y+wCYfe8j//qW941wMUIO8QV/BUIVpj 6ckxz/ZqCZaUcEhZmAgLkZHCEIGZ391OlshRI= 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=qzo+UO6rKhGS8H3i9OK87Ngl18bf6HViCqWtuB03u/E=; b=3AUVS1SlUvnjdipLnoQk37wJTGvuhcexPtx63CwhG2RCr6oDd2cD42S225tGniv5ew SgcGqq9xVhdnSsju+5IXCsxRhtjiAZb18hN1nOk+7BiJdbarUCoNO30IXIs/LXXaqHtJ xUKNfwLBDJiWIX8xe56mBt84lnvfsA4UQ9CI+HSNruiKE4I9xXlQI93NUSLY5NlNooAz f7Zp7pCUgruMaXueJH3BS41d9ju+L6/cvcz4/HMENDxS3kOl1syYiEZPrCOg5vZ3pl4M SRIFfvZbmX8dAsseMZ0KEFuRM3dZPUvTjjac2tSDM9QQlabFdRWNimHqO87GTJFCAw2S +muQ== X-Gm-Message-State: ACrzQf2xuQTNDPPtZ5R7Cv7LkTmiCrwLcqvirWftCkXYjDLatFNz7NYW yhesAKLdv6rino/cqDke0srH2A== X-Google-Smtp-Source: AMsMyM7RMqnJKcNesc8xRgpLESfPOrmIQondTpLCG88+n4Qycd5Ej9QZbYthOOomLsB9/+hUELa8gw== X-Received: by 2002:a17:90b:1c88:b0:203:8400:13a9 with SMTP id oo8-20020a17090b1c8800b00203840013a9mr13324117pjb.46.1667194897457; Sun, 30 Oct 2022 22:41:37 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:7616:afe0:ba6c:96f4]) by smtp.gmail.com with ESMTPSA id w12-20020aa79a0c000000b0056befcd7958sm3573308pfj.84.2022.10.30.22.41.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 22:41:37 -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: [PATCHv4 8/9] Documentation: document zram pages_per_pool_page attribute Date: Mon, 31 Oct 2022 14:41:07 +0900 Message-Id: <20221031054108.541190-9-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.1.273.g43a17bfeac-goog In-Reply-To: <20221031054108.541190-1-senozhatsky@chromium.org> References: <20221031054108.541190-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=QRDjYTAa; spf=pass (imf22.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.171 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=1667194898; a=rsa-sha256; cv=none; b=QwCogBb8dLnnbqUwhBZsYSsdccDKgnz+ZApy4hX7b9pnV67/Eid4KVzgC7Doxbpk/TkPq9 bPzUXW3D6CG/g/iG5L9C90lahPZuSRTdJ2uV1iwpJD0QGZ/pLAs7uWwR00QoT4PQTUcstI 7m/un9rAhkw3T+SQD7LNgpqbXY7oCL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667194898; 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=qzo+UO6rKhGS8H3i9OK87Ngl18bf6HViCqWtuB03u/E=; b=Aa9T04iohs5AtCySRE3fN57uwRAiKH29qnp3sz5GsCa7T+rqMNyI6swbKaCKjiRUoCZI5S KvGZo79u/qkcPTNBoZVoeP0jKLsz65zHg3fRxJxGba04RI1uTAuuy5OPvka3RhcCHrNJZK H0Sht+31RCNly2HTgaE6VjqEojw1X84= X-Rspam-User: X-Rspamd-Queue-Id: 906F7C0004 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=QRDjYTAa; spf=pass (imf22.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.171 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Stat-Signature: 56y4hqha9zodo5ugtqoooa4d6f4358mq X-Rspamd-Server: rspam10 X-HE-Tag: 1667194898-19491 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::