From patchwork Wed Feb 12 06:27:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13971032 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 DE341C02198 for ; Wed, 12 Feb 2025 06:32:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71B0F280002; Wed, 12 Feb 2025 01:32:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A45C280001; Wed, 12 Feb 2025 01:32:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 51DF0280002; Wed, 12 Feb 2025 01:32:26 -0500 (EST) 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 30C30280001 for ; Wed, 12 Feb 2025 01:32:26 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B5AA4C0E5A for ; Wed, 12 Feb 2025 06:32:25 +0000 (UTC) X-FDA: 83110323450.30.ED4F967 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf23.hostedemail.com (Postfix) with ESMTP id ADCB3140004 for ; Wed, 12 Feb 2025 06:32:23 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=oc16v3M2; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf23.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.177 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1739341943; a=rsa-sha256; cv=none; b=D1gUaR2K5Jo1qm0eIJPd4gy/x3Kh7N0Ky3OxC+a4XK4lyFqXrdwPHSUi7VqUj1f3GXF3Hm FaN6q1KhAIt9olSV2eodk5tUMlP5tDn45Q7Qx4veHVLojxvfm1nDKbA6NpIIamZbwypcG8 OOTXjEBXG38q4gMZQ43LNlY1PIEFPKE= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=oc16v3M2; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf23.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.177 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1739341943; 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=h2AQA5cUglzG6yhVm3aKj+975OMRekO7mg4bKTRqdCs=; b=WJnpanFb70S6LcovkEM3qgO4IV8Jy71z6MLZOIjS+F5fewXpgEBxW28YVB+J+w+nmKyK/B anHiQTF6KB17foCIK5QLiKC6waeNfJ7P2Gqg4RcF2+HUdSH/foXKsWPGlpAzKuEweVCr+u DeQSQdLR5F/jLfUavPAyrcDfhPj+89M= Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-21f6022c2c3so8169405ad.0 for ; Tue, 11 Feb 2025 22:32:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1739341942; x=1739946742; darn=kvack.org; 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=h2AQA5cUglzG6yhVm3aKj+975OMRekO7mg4bKTRqdCs=; b=oc16v3M2vQFMlRypHc0eDEuezAgkQ03MMrwIarcLE+XVThK3BRSWTn6Bd777gp6T0P rtCRvuO1TcVeSdzkRN83mLbQZL9tQ1cJIXM2LhkUba0flN7kE68VEczJnt4QuefLJl/W vq1DwbyB4rnF2lQhQZcUpzot+7eDG5Rus3ifY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739341942; x=1739946742; 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=h2AQA5cUglzG6yhVm3aKj+975OMRekO7mg4bKTRqdCs=; b=ZoeSlBGt9Jy1JqAin4xu/WB6/9bV2jtDvhiz4qLS9lw72zVnCribcE1toCuvteZWDp EMIsJjeFavpPGvaaOTvX5Y704BkeNbBEqnV4a9MKzKA/vX90Qh2zw4LaGrcqpWx0oHaP Ap/cdppHyx1nq9CloNNW5z+CfailTSsSzY6YCURbkq7x6MbxgsaU8D8UmreKCfr2xTvO gX6bhUIfarjyOdMzhBZN3Ru4RG1HDxTdrXY91+esT69/eI6qOvhUQtDWqy8e5Br1fbpz L96b7ErKrEA+vei8QZb8GiFbigl3a3JYLq+JiZfw40idp2g+4Z1bPXcivHtdqct6RC+a g0OQ== X-Forwarded-Encrypted: i=1; AJvYcCVfYbGKLgP0La1sCaRffC6LfnY2KNJMmsC7jZmN5ZlxdMizoB+J743jBNq1+OF5sf0OD2+Sug3A/A==@kvack.org X-Gm-Message-State: AOJu0Yw/BgEKUH68ZKNBCg6yaWEC0o08x8Xk++IyVxUi2LMkblzPJ/C5 6zZtrlWWfM2PcYLJuJPmqbPRkugqqRiNwxivLnDuB8oc+rfQ9fBdM43GbEMiXw== X-Gm-Gg: ASbGnct9Xl82ZCk7av1QWsyDb0hlaj7aE2/J7M1/kfkM0ohGL0KxLzEuLukmaE3DAGd QVdzcolqqSoWsh9GVB6p4oKwloSO8igzmZ0xpy+8CljMzhssPAzCg2GHtsEVSGO+TFF+ZkcHFNe 4mj8+KdF/jNmTsfoARsRoOc4q17q2gpCTNhUUciE/CX5Mc3vndUsTlVp/3hTFaZxKr0BUXuiBah XQKuWc6q6l37Vl9845YqU0nIxjLmuYtaRGLoInOe86KzPqqUY+c2gxanGIGnxjpRuRWGEmSJbK7 hdcow9MshNO42TTvWQ== X-Google-Smtp-Source: AGHT+IFvCaT4j3C930RCMRawLzcITwesvr3FnYejPnLHFg8E648OUmGxFSWdbEBwV5fB9AnLznY3OA== X-Received: by 2002:a05:6a21:398f:b0:1d9:a94:feec with SMTP id adf61e73a8af0-1ee5cea8113mr3339152637.2.1739341942625; Tue, 11 Feb 2025 22:32:22 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:69f5:6852:451e:8142]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-730918f6ec7sm4475974b3a.37.2025.02.11.22.32.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Feb 2025 22:32:22 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton Cc: Yosry Ahmed , Kairui Song , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCH v5 04/18] zram: remove max_comp_streams device attr Date: Wed, 12 Feb 2025 15:27:02 +0900 Message-ID: <20250212063153.179231-5-senozhatsky@chromium.org> X-Mailer: git-send-email 2.48.1.502.g6dc24dfdaf-goog In-Reply-To: <20250212063153.179231-1-senozhatsky@chromium.org> References: <20250212063153.179231-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: ADCB3140004 X-Rspamd-Server: rspam12 X-Stat-Signature: cfpjci4kzjrxsmo756npzmwprzihh3bk X-HE-Tag: 1739341943-720229 X-HE-Meta: U2FsdGVkX1/3OYcCYRHomsyJiX/SE/YuISGN5cVu5BbnDvk1blBbNSYUFil3DzrGcAopwkUDPHx79hbje36HeRcjC7Bw8OoypcaToehnaGgVUSnGBnbJN7LhMj2GcrS2iYUu1qWbVCN5e57ZvVvRK6uGjFd5Q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iCqzU5d0hy9CjG+BEL/FTyGL7q/lKdiPKlYUH7uYL9vImbrpa2ZmcCDMS3NvBFJYluZSlrPWwJ+x2OI8RvIU8mxOJTh/o9u53Bwp2a3aqF0BDC/gHDtVFGsKZVI68wkGiSwCrEa6vNG0Lr4GkYHSMLmO+ 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: List-Subscribe: List-Unsubscribe: max_comp_streams device attribute has been defunct since May 2016 when zram switched to per-CPU compression streams, remove it. Signed-off-by: Sergey Senozhatsky --- Documentation/ABI/testing/sysfs-block-zram | 8 ----- Documentation/admin-guide/blockdev/zram.rst | 36 ++++++--------------- drivers/block/zram/zram_drv.c | 23 ------------- 3 files changed, 10 insertions(+), 57 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-block-zram b/Documentation/ABI/testing/sysfs-block-zram index 1ef69e0271f9..36c57de0a10a 100644 --- a/Documentation/ABI/testing/sysfs-block-zram +++ b/Documentation/ABI/testing/sysfs-block-zram @@ -22,14 +22,6 @@ Description: device. The reset operation frees all the memory associated with this device. -What: /sys/block/zram/max_comp_streams -Date: February 2014 -Contact: Sergey Senozhatsky -Description: - The max_comp_streams file is read-write and specifies the - number of backend's zcomp_strm compression streams (number of - concurrent compress operations). - What: /sys/block/zram/comp_algorithm Date: February 2014 Contact: Sergey Senozhatsky diff --git a/Documentation/admin-guide/blockdev/zram.rst b/Documentation/admin-guide/blockdev/zram.rst index 1576fb93f06c..9bdb30901a93 100644 --- a/Documentation/admin-guide/blockdev/zram.rst +++ b/Documentation/admin-guide/blockdev/zram.rst @@ -54,7 +54,7 @@ The list of possible return codes: If you use 'echo', the returned value is set by the 'echo' utility, and, in general case, something like:: - echo 3 > /sys/block/zram0/max_comp_streams + echo foo > /sys/block/zram0/comp_algorithm if [ $? -ne 0 ]; then handle_error fi @@ -73,21 +73,7 @@ This creates 4 devices: /dev/zram{0,1,2,3} num_devices parameter is optional and tells zram how many devices should be pre-created. Default: 1. -2) Set max number of compression streams -======================================== - -Regardless of the value passed to this attribute, ZRAM will always -allocate multiple compression streams - one per online CPU - thus -allowing several concurrent compression operations. The number of -allocated compression streams goes down when some of the CPUs -become offline. There is no single-compression-stream mode anymore, -unless you are running a UP system or have only 1 CPU online. - -To find out how many streams are currently available:: - - cat /sys/block/zram0/max_comp_streams - -3) Select compression algorithm +2) Select compression algorithm =============================== Using comp_algorithm device attribute one can see available and @@ -107,7 +93,7 @@ Examples:: For the time being, the `comp_algorithm` content shows only compression algorithms that are supported by zram. -4) Set compression algorithm parameters: Optional +3) Set compression algorithm parameters: Optional ================================================= Compression algorithms may support specific parameters which can be @@ -138,7 +124,7 @@ better the compression ratio, it even can take negatives values for some algorithms), for other algorithms `level` is acceleration level (the higher the value the lower the compression ratio). -5) Set Disksize +4) Set Disksize =============== Set disk size by writing the value to sysfs node 'disksize'. @@ -158,7 +144,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. -6) Set memory limit: Optional +5) Set memory limit: Optional ============================= Set memory limit by writing the value to sysfs node 'mem_limit'. @@ -177,7 +163,7 @@ Examples:: # To disable memory limit echo 0 > /sys/block/zram0/mem_limit -7) Activate +6) Activate =========== :: @@ -188,7 +174,7 @@ Examples:: mkfs.ext4 /dev/zram1 mount /dev/zram1 /tmp -8) Add/remove zram devices +7) Add/remove zram devices ========================== zram provides a control interface, which enables dynamic (on-demand) device @@ -208,7 +194,7 @@ execute:: echo X > /sys/class/zram-control/hot_remove -9) Stats +8) Stats ======== Per-device statistics are exported as various nodes under /sys/block/zram/ @@ -228,8 +214,6 @@ mem_limit WO specifies the maximum amount of memory ZRAM can writeback_limit WO specifies the maximum amount of write IO zram can write out to backing device as 4KB unit writeback_limit_enable RW show and set writeback_limit feature -max_comp_streams RW the number of possible concurrent compress - operations comp_algorithm RW show and change the compression algorithm algorithm_params WO setup compression algorithm parameters compact WO trigger memory compaction @@ -310,7 +294,7 @@ a single line of text and contains the following stats separated by whitespace: Unit: 4K bytes ============== ============================================================= -10) Deactivate +9) Deactivate ============== :: @@ -318,7 +302,7 @@ a single line of text and contains the following stats separated by whitespace: swapoff /dev/zram0 umount /dev/zram1 -11) Reset +10) Reset ========= Write any positive value to 'reset' sysfs node:: diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 12fb260e3355..e0e64b2610d6 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1104,27 +1104,6 @@ static void zram_debugfs_register(struct zram *zram) {}; static void zram_debugfs_unregister(struct zram *zram) {}; #endif -/* - * We switched to per-cpu streams and this attr is not needed anymore. - * However, we will keep it around for some time, because: - * a) we may revert per-cpu streams in the future - * b) it's visible to user space and we need to follow our 2 years - * retirement rule; but we already have a number of 'soon to be - * altered' attrs, so max_comp_streams need to wait for the next - * layoff cycle. - */ -static ssize_t max_comp_streams_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return scnprintf(buf, PAGE_SIZE, "%d\n", num_online_cpus()); -} - -static ssize_t max_comp_streams_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) -{ - return len; -} - static void comp_algorithm_set(struct zram *zram, u32 prio, const char *alg) { /* Do not free statically defined compression algorithms */ @@ -2541,7 +2520,6 @@ static DEVICE_ATTR_WO(reset); static DEVICE_ATTR_WO(mem_limit); static DEVICE_ATTR_WO(mem_used_max); static DEVICE_ATTR_WO(idle); -static DEVICE_ATTR_RW(max_comp_streams); static DEVICE_ATTR_RW(comp_algorithm); #ifdef CONFIG_ZRAM_WRITEBACK static DEVICE_ATTR_RW(backing_dev); @@ -2563,7 +2541,6 @@ static struct attribute *zram_disk_attrs[] = { &dev_attr_mem_limit.attr, &dev_attr_mem_used_max.attr, &dev_attr_idle.attr, - &dev_attr_max_comp_streams.attr, &dev_attr_comp_algorithm.attr, #ifdef CONFIG_ZRAM_WRITEBACK &dev_attr_backing_dev.attr,