From patchwork Mon Oct 24 16:12:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13017769 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 16095C38A2D for ; Mon, 24 Oct 2022 16:12:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A439294000D; Mon, 24 Oct 2022 12:12:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F377940007; Mon, 24 Oct 2022 12:12:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81FC394000D; Mon, 24 Oct 2022 12:12:37 -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 6E8D9940007 for ; Mon, 24 Oct 2022 12:12:37 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 41BF9120261 for ; Mon, 24 Oct 2022 16:12:37 +0000 (UTC) X-FDA: 80056335954.13.9F3B330 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf16.hostedemail.com (Postfix) with ESMTP id CFC03180038 for ; Mon, 24 Oct 2022 16:12:36 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id h14so8455545pjv.4 for ; Mon, 24 Oct 2022 09:12:36 -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=0+L/wgZJq25QWZOfBJI7Y8G4kNdlVFzsE8gcKEq0Mfs=; b=ZT+bcVMBNk7fpdzG51qvU+nw1MQlFcyYzv6wxeZnY1j+dre6v7vQ6lHY5Ifk344dlP gdAvAMVQmF+7ROzaIojNXfakKOHyzc9qvCV2j2xBa1B8l4HMqv5zJmx3MP2QUkXEn+gr ee7UlBpMa++JOciZw2MCsyIYwsJxjL7k2zx7k= 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=0+L/wgZJq25QWZOfBJI7Y8G4kNdlVFzsE8gcKEq0Mfs=; b=HvYWq5EiZs5cw2sPEvrqLiDFgtFP69hwNIaQsuJqPpKvzszlxPOh1lCdt2mX4J9f3X HTFz1YrHGAWyqQ478lU9vfuwyCppesBB+5OewqY0//sxCMBxn3ETEZirmePmQ+p9Gh8l w0zZuMY1xCuiI2TJgulqIo4frNCZihgjzdlDy7OxqFAeYR1JsfJKxgjsrmH9Loc8Sk4X 0COhT952gwZ6jLmL7YabiFjjsgFYZoxNB0zVykovTbjPytyMncq5LEuH2y+b/Q4h5ny3 k6OtN3Ns2z3qTsnwPHQKJk0XbdvtCZwVw5t1DkRvoVbtmDuGmilrloXf1WZ50vyS9qYS ubSg== X-Gm-Message-State: ACrzQf1+NBrfqgu5er+CHfXgSbcZyPNot/CXgUMYJtlEwwNjOTDB8BD+ PpSVWehDrLLxqPkZkqxQqJY4hA== X-Google-Smtp-Source: AMsMyM7QdS4FtEGrBDpWgc9Evd5MJ+xSYAJnNXyqo5gXSJ1mvVH/il24Yx4mUoL6wddj14/oGzHbng== X-Received: by 2002:a17:90b:2317:b0:213:26a3:246f with SMTP id mt23-20020a17090b231700b0021326a3246fmr3082381pjb.148.1666627955871; Mon, 24 Oct 2022 09:12:35 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:5f9c:c5bc:902f:3da4]) by smtp.gmail.com with ESMTPSA id u70-20020a627949000000b0056b8726d2d3sm5162pfc.157.2022.10.24.09.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 09:12:35 -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: [PATCH 4/6] Documentation: document zram pool_page_order attribute Date: Tue, 25 Oct 2022 01:12:11 +0900 Message-Id: <20221024161213.3221725-5-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221024161213.3221725-1-senozhatsky@chromium.org> References: <20221024161213.3221725-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666627956; a=rsa-sha256; cv=none; b=eTN9St9Rit89x/Lp0a8oIqvZsmmZpU6UAY4h2AWqFDfKjEc5SDBWsk20y3ZdVQdPsuLhOb 58zdFZlONCS1Ktd34QXentod7zE5/vNJeNb+/4uAxyuCtElxtNKrMX2suAgQeNhYeVzPmE fKA5dKX0mQGBahfmTHjpDP9hENH4/UA= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=ZT+bcVMB; spf=pass (imf16.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.42 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=1666627956; 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=0+L/wgZJq25QWZOfBJI7Y8G4kNdlVFzsE8gcKEq0Mfs=; b=aeoN9fRYMV2QKhu5H6I19K0Qf4B1UwR02zX14X0G43NBLMXajCVFt/paLU2Ujke9CKyJ4R e8NEHZTOJVkeHvu7Z0tMtY7JmKmbT2SRfymSGnrS6HWeL13Ne1A8cK3A9oJnSMtQEn9dgh wmlpJybHAjeBoapA12jUuJwYczG+dq4= X-Stat-Signature: pjigjsimy63j7jynxp7rxje6d7in3h19 X-Rspamd-Queue-Id: CFC03180038 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=ZT+bcVMB; spf=pass (imf16.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.42 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1666627956-803215 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 zram pool_page_order device attribute. Signed-off-by: Sergey Senozhatsky --- Documentation/admin-guide/blockdev/zram.rst | 31 ++++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/Documentation/admin-guide/blockdev/zram.rst b/Documentation/admin-guide/blockdev/zram.rst index 010fb05a5999..cd12a5982ae0 100644 --- a/Documentation/admin-guide/blockdev/zram.rst +++ b/Documentation/admin-guide/blockdev/zram.rst @@ -112,7 +112,24 @@ 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 maximum pool page order +============================== + +zsmalloc pages can consist of up to 2^N physical pages. The exact size +is calculated per each zsmalloc size class during zsmalloc pool creation. +ZRAM provides pool_page_order device attribute to see or change N. + +Examples:: + + #show current maximum zsmalloc page order + cat /sys/block/zramX/pool_page_order + 2 + + #set maximum zsmalloc page order + echo 3 > /sys/block/zramX/pool_page_order + + +5) Set Disksize =============== Set disk size by writing the value to sysfs node 'disksize'. @@ -132,7 +149,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 +168,7 @@ Examples:: # To disable memory limit echo 0 > /sys/block/zram0/mem_limit -6) Activate +7) Activate =========== :: @@ -162,7 +179,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 +199,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,7 +300,7 @@ a single line of text and contains the following stats separated by whitespace: Unit: 4K bytes ============== ============================================================= -9) Deactivate +10) Deactivate ============= :: @@ -291,7 +308,7 @@ a single line of text and contains the following stats separated by whitespace: swapoff /dev/zram0 umount /dev/zram1 -10) Reset +11) Reset ========= Write any positive value to 'reset' sysfs node::