From patchwork Mon Mar 3 02:03:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13998054 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 674C4C19F32 for ; Mon, 3 Mar 2025 02:24:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EDC30280004; Sun, 2 Mar 2025 21:24:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E62EB280001; Sun, 2 Mar 2025 21:24:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB6DE280004; Sun, 2 Mar 2025 21:24:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AA039280001 for ; Sun, 2 Mar 2025 21:24:57 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 545121409E0 for ; Mon, 3 Mar 2025 02:24:57 +0000 (UTC) X-FDA: 83178647034.25.DA2067E Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf29.hostedemail.com (Postfix) with ESMTP id 79181120006 for ; Mon, 3 Mar 2025 02:24:55 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="nvgjww/Z"; spf=pass (imf29.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.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=1740968695; 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=bWS/5MPcWfCH0A9JfQHKT/0nLElRz817vLkO7NmScms=; b=xKY08HG558yBY0/5u39pkqwwFN994haITqBsxWPcMvtTFBQuvTOLsu9eaXaqe/F8ynCwXc yFvvCXMH+8QeqzmBCNPQBFHd4Deew7hNbCozGt7XHejqPcmN98FbX88CxJcuowBSU11JPt rC+35MTEDR2q/flRK25Sj4DOD4Oe6HQ= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="nvgjww/Z"; spf=pass (imf29.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.176 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=1740968695; a=rsa-sha256; cv=none; b=s4njq9zBpLuLNMqOTZn6RZcb/hoRZP8DCF8RTIFrvsXULdk4axcpHrd0hWXWVpY8YaOugI HLet1dURC76ZMTMVZdcy7ftV2xXGeF+ltIOEjnVmjK0iJHrLsjthcq9Ir7pa2f0SGZkK4X i5Kdkj+NuIY9nB9kydEpixoT2kAhlOE= Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2239f8646f6so14277195ad.2 for ; Sun, 02 Mar 2025 18:24:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1740968694; x=1741573494; 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=bWS/5MPcWfCH0A9JfQHKT/0nLElRz817vLkO7NmScms=; b=nvgjww/Z8VguBlP9ApI71UkNAJ+nwfvGvJ5oD+twqOKsj++I8PnTCcEBifQ7qtwgDI 9hSLLdJ146WSSNPBeaBCHRJl767eQNUmt2ZwLlNqF+IVNZK9jTZ0aNnnWfdptKZPqqn5 R5FEPpiKZNyT/J7nF4BT6k/szfuvRotqJfkqI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740968694; x=1741573494; 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=bWS/5MPcWfCH0A9JfQHKT/0nLElRz817vLkO7NmScms=; b=LKBskvYI+vhyTB1BuxSeA3HEGKHHYfNPEal1fxQbZ2nPFoJVya0KG0WnC8GFb3aogd gFv/IyWUyIcSt+8kr0Jz4zdWzKDLoefeRlu2BfKNWlxZtGqYIpDC/lbmAUcbQU1+WvFR CsJqmCONFxKx75AAWtQu7b4HxcgN8HYQ3rrejzhZdfC4N82qm8dBrSZeYJL0uhwoZ3JX BsY/8++E1eqpGGwvj4fF40iF5B2kAjK9g58Mv9YRUZyZOAmplZUuoHh+TDBlUkuuyNrX UPoUrxfhkv5nxYE1prGt8GgAL5LeQLgVo149xqtS/uDgvuI139FxUXN0dX02eEP8Q7Nt dDAg== X-Forwarded-Encrypted: i=1; AJvYcCXx6yhl2fJwcbn1nfWVBzdoKcFpjHj/m6DDmzlnAMcnYVQWEeE1ByI2JwdUjagxismfk6TqfIHkJg==@kvack.org X-Gm-Message-State: AOJu0YxU2J5e/BRjcwqyY2praoUtTW2rlVa0yNNlncr8zoLBTaMOvQiZ 1jNwoiSkMN0QXtPanTc+/MK4KUbKElmEXgiiVmKxLbjlaNfwVUGqDP6e9vzSMg== X-Gm-Gg: ASbGncvOeiyfCkiwKyuHAkRqE8E/btBlY/5PqmANPtBlRrWdLqjdWh3kTdXmPkhKnzc wAxfNOvE8JoB7bzrYE+IkhI4ACx484GnyV7qcgGsl+wxWC30qC2YNC2mguk4ceaOMOmGX07MYVY 7BcajT6AK+foUrx7USosJjVtUQiiKEz+MqaC/iDSGJSDh0aq9ZNHKI7ndmHMEG4ZMH3BtwM/Hds w5fwpcRJ1OK8JCapXVX7LzOzwBpWF8gVRkPLi3wuhN41rwO8AnnJppnvgQdxULYL0jnVf9u5dcG Sa9hodcznSm284HLySS8DKOkf43v7ocMaxhLEReICznutg8= X-Google-Smtp-Source: AGHT+IHSDPg6+GlHfcOXSQ76GatOFpUQPAH1lRliAnvxfV2K3YTVpkBHpg9ehwbe5zk/2PLiRfIsOg== X-Received: by 2002:a17:902:e807:b0:223:6657:5003 with SMTP id d9443c01a7336-223691f8f1cmr201725005ad.32.1740968694360; Sun, 02 Mar 2025 18:24:54 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:1513:4f61:a4d3:b418]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-223504c5cc6sm67129725ad.112.2025.03.02.18.24.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Mar 2025 18:24:54 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton Cc: Yosry Ahmed , Hillf Danton , Kairui Song , Sebastian Andrzej Siewior , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCH v10 04/19] zram: remove max_comp_streams device attr Date: Mon, 3 Mar 2025 11:03:13 +0900 Message-ID: <20250303022425.285971-5-senozhatsky@chromium.org> X-Mailer: git-send-email 2.48.1.711.g2feabab25a-goog In-Reply-To: <20250303022425.285971-1-senozhatsky@chromium.org> References: <20250303022425.285971-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Stat-Signature: 6h44eq8arsn987dnjwd8bybhhkx8qh3r X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 79181120006 X-Rspam-User: X-HE-Tag: 1740968695-275964 X-HE-Meta: U2FsdGVkX1+DdUCJWa/LM4KfhBgMqUBXBVqJqn4xFBvpxrrtmpdIkJ1icAiz9Ll7en2Wn+mQyUHV+q60wVwJuixw/kZMXekJiz1w5ReNhdTI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ue5QQ7cELWmqHe39f4OcpeR1e1ZSTXPOazXVsNFK5B2/X6NWkBn30LmFIfPh5uYJOl83Xa5cIAj/GFqYyNHaafxzc6NU3p4mUSzvUhqaU4duL5Juc4WJkOVSEs0ohCw6rnU/SzedghkJ9x0TD1Glc1BUNHNB/J99RegUFy0qSQUHBkoVpXkC3e0CyPD/b2xBXV 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 714a5171bfc0..7ad4c86f8258 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 248dab7cc7f4..93cedc60ac16 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1103,27 +1103,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 */ @@ -2540,7 +2519,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); @@ -2562,7 +2540,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,