From patchwork Thu Feb 27 04:35:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13993734 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 6076EC197BF for ; Thu, 27 Feb 2025 04:36:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE67E280006; Wed, 26 Feb 2025 23:36:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D9786280005; Wed, 26 Feb 2025 23:36:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C37C4280006; Wed, 26 Feb 2025 23:36:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A3F36280005 for ; Wed, 26 Feb 2025 23:36:56 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 126051C7045 for ; Thu, 27 Feb 2025 04:36:56 +0000 (UTC) X-FDA: 83164464432.10.FFFE64E Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf16.hostedemail.com (Postfix) with ESMTP id 23BFF180010 for ; Thu, 27 Feb 2025 04:36:53 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=BOemDG2K; spf=pass (imf16.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.172 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=1740631014; 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=DWBUXpwpeVKwHwztQYQNBbUUc1WcNoYn31qV1KKEn5Y=; b=mPmY6a2bImm3Zf9YZgjESt/6wCr8P5/VsO+2R04cN16BhDijUUTcV2OlEmbj5VFmLwv6P3 KeNEvzMTvxrf1dM3VslkIN7HZzyRfHdDLExrVZm1Ia5IdHYTojKqG+Uobw6DbVt2JUzaAY WS3bb0WiYtCJqW67SLMY47KljvNuifM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740631014; a=rsa-sha256; cv=none; b=dKdZP8YcxpETvE52YwNyIpxswqJh2tFcJZWqNEKqzRTkADF96n7jIGhWbdRY5rCLYLT7zn s2mQ7HaqJiB9trxtlLdO7taQK1rJcZmh+eIk9sZKFzQ7UxEVX/wcDPFgxQbNSwCnQPlKXu SWTuxG2tvEeDhrk+CmRHYZqcY043v3M= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=BOemDG2K; spf=pass (imf16.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.172 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2235908a30aso364045ad.3 for ; Wed, 26 Feb 2025 20:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1740631013; x=1741235813; 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=DWBUXpwpeVKwHwztQYQNBbUUc1WcNoYn31qV1KKEn5Y=; b=BOemDG2Kq1I/MYpEJ9HYHRRUVHZUJ4A/cTKkokaXllaRTYN5zUyXxhlZEEW6n6KGlW KyYq3SdoHspS1h/h1Q7djUMeDNfaxKjUeZ1tuzR01H9Xlbm4P8f8f9UOFscz6vpp7bW1 VC+D37uq9pgeyyDUgoBFNdaZncoK6/f16s3gU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740631013; x=1741235813; 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=DWBUXpwpeVKwHwztQYQNBbUUc1WcNoYn31qV1KKEn5Y=; b=Nsg7V0767wWeNpauVf0yE0QnoAXHUkxsEfmEDgyPCNZ8RUf95pTvNMe94VioOOOWDi KSid4118WzFbazgQ1cDpTAQlFVc3b8V3F+6urj/yC6WI6SPYRMVLtIL32q3HQ6MmsLf4 3IP5r39AhCdhmZV4eDnOBDfhsLpilPDmbTYN49YuouSFncARsPTpy/rpRdHudPYCkhf+ VIYUmok1tdaBR0q0+FLFT7UPN2zC11oePXScylb1zfW8WV/3SkvGe3K7W1E+ODCbW/EG jczrAl/mNXGu5UhCt7GaftYG+6L5gt+GrlkN/P28tXP7XbmiHvvGyvVGZ9+6y0OId/XI FBng== X-Forwarded-Encrypted: i=1; AJvYcCVwM0GU1OSoKPXVILspElyASkqKfJGngKzzdfeIaqzvGocCiQ8tuMMQv56gIRrlGUBREpxHBFqgdw==@kvack.org X-Gm-Message-State: AOJu0YwcQN0neB83w6V3sHaSwt46lxq5Lkyf+7oOesWwBq9wOX5imvJO MvXBPB+sjgm9mJqWPYJv7WGIpz0MHnYA9oCsjpDBfMawNhv/QIo/4JjowHfMXw== X-Gm-Gg: ASbGncuW9TmjGFnNWEASknXhgq78Itkvkz92pxKUHUJSp+JKvGXneTEycwqn5ueJ2bQ WB4qvJsQ3Ji7F2cj0dBYv0kFLvrLY+X77zmL3inFm6ffh6kNBAbXnM+AyGItQOq9Wl4l7qZrMSI 84YtE8ofUnrk8R8flFpOi9Wh0GJ4P2TKNwj79znXmywn4fZPZnw0KuIGXz88vzs6V+JkrE8pFY2 nDYLqLKYF16sivRVaKMpQxvVlwdTey9MgU96ZW2030afmTMzbR3qIqScO7hMe4D8UpbaIFQUHTT +XSSIvQE8371sqi/GZhkIoeUr315 X-Google-Smtp-Source: AGHT+IHsEmBFpQZ3F93ddNTk7TR/BbwMCem5lOBEnuVdbTxvBpCIY+MLGxmXXQpOcN29GcZXld6Agg== X-Received: by 2002:a17:902:d2cc:b0:216:3e87:c9fc with SMTP id d9443c01a7336-22320082b84mr97602405ad.5.1740631013020; Wed, 26 Feb 2025 20:36:53 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:a9c0:1bc1:74e3:3e31]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2fea6985226sm462165a91.40.2025.02.26.20.36.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Feb 2025 20:36:52 -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 v9 04/19] zram: remove max_comp_streams device attr Date: Thu, 27 Feb 2025 13:35:22 +0900 Message-ID: <20250227043618.88380-5-senozhatsky@chromium.org> X-Mailer: git-send-email 2.48.1.658.g4767266eb4-goog In-Reply-To: <20250227043618.88380-1-senozhatsky@chromium.org> References: <20250227043618.88380-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 23BFF180010 X-Rspamd-Server: rspam07 X-Stat-Signature: otmpgr8zdkzy6u3mir456scb564huq3s X-HE-Tag: 1740631013-392979 X-HE-Meta: U2FsdGVkX1/2FkiOLVACoFabZ0PJ/yshhK1PqNLkP/Q1yrLmzPUbKAu/c/qAGFZbBFtls1vTlfStgtDMDtxcCJ9urt0MUWzZWwKYD/RvwqfsRPU8zMdvabmUkt04UE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1m3lJEQwOEjl4b9KEkWb5LvWa9wsvbgko25ntF9oe2/pNH+a5Z4NpCJ0MBYuXPGWHdZSRo2pLA/7thQMOr4o6aN3h83GSPzOPebAtTGmOSdjGpS2XYO9uJYTc9eSdsH6++VTWr1jz5S+dvuk29dnCJIqEIjDRed3HIwAhACJVbyvvgVFIEi 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 ff662144b98b..5f2c08337ba9 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,