From patchwork Fri Feb 14 04:50:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13974466 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 3ECE2C021A4 for ; Fri, 14 Feb 2025 04:52:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 848726B0092; Thu, 13 Feb 2025 23:52:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D1BB6B0093; Thu, 13 Feb 2025 23:52:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64C8B6B0095; Thu, 13 Feb 2025 23:52:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 416776B0092 for ; Thu, 13 Feb 2025 23:52:45 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A3B0844030 for ; Fri, 14 Feb 2025 04:52:44 +0000 (UTC) X-FDA: 83117329848.24.F0FB8F3 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf10.hostedemail.com (Postfix) with ESMTP id C1B1DC0002 for ; Fri, 14 Feb 2025 04:52:42 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=iWqNTlpa; spf=pass (imf10.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.181 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=1739508762; 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=N0yPBZnADO0X5Vq2D3cbKq9jy8e5O0FW3A6DJipxArU=; b=orH3R8FehJUzx9p/AQnPTRpG0Ko6euiWZBs2fNPivtGTpPjpTPU638RgcNziFswMwlrgdt 7gl//lhQm+ZIlzUKrifCrCN1Xj89qRpJ5f0+rG4pCkBYay2mzNoke0+05oT8CvZ3P8LU49 +flSq9a1Vz8JALs/omeWsyuI61HPJHA= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=iWqNTlpa; spf=pass (imf10.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.181 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=1739508762; a=rsa-sha256; cv=none; b=sSt7bneeCqlfvs67ABrMTqpTnMqBm/34pN65K1zm2iTx28pQO6Dc4eq43tZU7Dl5Gm3f7n P86kyIOijXkSx1tarZre4OKXzTxUUz1sq1GuKL1zfpi81LRhlkMXQViKakEZxbvJBq84no 0sG6Yy49tX1JMFeyDMEcFKYrPe9qvcY= Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-21f44e7eae4so30059335ad.2 for ; Thu, 13 Feb 2025 20:52:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1739508762; x=1740113562; 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=N0yPBZnADO0X5Vq2D3cbKq9jy8e5O0FW3A6DJipxArU=; b=iWqNTlpa0OF1NGpQsrKYCZpfSGy7hhJAcZUcTb+IsLE4WPd5hiItcp0Jdr71xmmMLn MxvyiBl3x7uQcm9tOoXdvIyyy6YDucQDvRJ2xXbHnFrTtkJjaNbYLq59QJSIUIC8brx9 l2CCrSHTFcYpOiEJvgSCr11/lXJjG0AtnI8Ow= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739508762; x=1740113562; 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=N0yPBZnADO0X5Vq2D3cbKq9jy8e5O0FW3A6DJipxArU=; b=XErH2z0PtK1AjufxALockRHrqjonMnGbMQLWpKcKMKT+l4PXdCfhug3l7zqeQUtp5i LIwmy3pUEdPh+10BGPlWoOTLOXGtKb9MV/5qU1EmdEdKOAHM84y61rD6cLErasx3BLfH z1uxnFzoQ4qmJTJ86tdJEB0ctUayMmBuqGlbpHftDb67rgMO5+cCwIwatbkj8DYYVG/B 61okLs6BRoajbMU5Be1jxu755J/3Y/r3BZsZ08Ghigth4/WkL3Ap7EvUKrx6aV+0yGMI nTnry/OnvvEpgbWn+MPTFg4Olx/HtPYcOXzJNi+1F2qPOR6DH6icGmqcI91xePsGRdTY AJuw== X-Forwarded-Encrypted: i=1; AJvYcCU7llmOnbClLzFbw61uWK60tALwnNdYHa3xTqPzNcYl74iwGsR9LKGdSNDkfpldeA91qpio4NU5Cw==@kvack.org X-Gm-Message-State: AOJu0YwzvyTaTupHe1cVrtu4qJr82fqUAoBAVaqhoddP1VfO9t0RavAi JwrFl3EwHsU0Sxu5g5UJVZULqNIginMvXcbSN0aBjuy9w5L5ZkB5FHMJp6MIGA== X-Gm-Gg: ASbGncsohIb8wn/4pkc5Y9ZpbrrodxatwgEWGe8fvpnd7Oi4RH5GAq3X2CmX085jn27 JvJ+iXOtl9UVwuzONwUy+Xq9dE3kLhoGwPYfJM/BGYxUU5gLHL0LzAqNX1BH6JBBUHoUUSOTezE eI3W3CfGK/om/NupgvHJCcngTvLBgFKRagrGtM+JdRoZmZ1BCFFEKp+v2RCXCIPcqte6/UDHwem kARUpNhxvYzkOog4s3y7gJwmiehLfAoSw98xfdFnhM0YxxtWWz7P9gduGCbJK09kfVjiOXr1Fsy ZfiQP/AMblc7dmDzNQ== X-Google-Smtp-Source: AGHT+IE0+HWw32m7Iz+CmsIdF7+EuP5uBVLXDu0uGMgAdMpaEB0vwPlOHOUHVWWjUpawD6FafZNm6g== X-Received: by 2002:a17:903:1ca:b0:220:d257:cdbd with SMTP id d9443c01a7336-220d257ce68mr96793445ad.48.1739508761612; Thu, 13 Feb 2025 20:52:41 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:942d:9291:22aa:8126]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-220d545d474sm20667535ad.116.2025.02.13.20.52.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Feb 2025 20:52:41 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton Cc: Yosry Ahmed , Hillf Danton , Kairui Song , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCH v6 04/17] zram: remove max_comp_streams device attr Date: Fri, 14 Feb 2025 13:50:16 +0900 Message-ID: <20250214045208.1388854-5-senozhatsky@chromium.org> X-Mailer: git-send-email 2.48.1.601.g30ceb7b040-goog In-Reply-To: <20250214045208.1388854-1-senozhatsky@chromium.org> References: <20250214045208.1388854-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C1B1DC0002 X-Stat-Signature: a7orgx5hu374hsp7aoxctk5whftr3oe8 X-HE-Tag: 1739508762-921293 X-HE-Meta: U2FsdGVkX19vQ2mZGiOUWaznCESNUsNlebr4PZZGVY4JQUpNuNDZ+SbxWAjxQsB7/a9e+tAcNvSm88Y5tiPU6Jfypo/jEHl73mWjvmd5FMeWK/1peTQOPbpLf+4r6r7NOLF2LZ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wG3ZPWJSj75jRO8yREVKHSpur13ETQPzpuWH95YsE53UHlex+WRBLz3huB2T/2S6T0rUKPxB5P14dLCRQWNB1kh38PG0LXFm9IVwFndNvWZmHJ+0tssWyZkv9YVVOD3VIR99laNLfjjS5of75YWYLgVj+n 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 0c8821b2b2d9..cc4afa01b281 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1146,27 +1146,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 */ @@ -2583,7 +2562,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); @@ -2605,7 +2583,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,