From patchwork Thu Jan 30 11:10:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13954484 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 4714CC0218A for ; Thu, 30 Jan 2025 11:11:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC9946B00E2; Thu, 30 Jan 2025 06:11:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A2AF26B00E3; Thu, 30 Jan 2025 06:11:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8562F2800D6; Thu, 30 Jan 2025 06:11:36 -0500 (EST) 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 5DE496B00E2 for ; Thu, 30 Jan 2025 06:11:36 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D4356140BDF for ; Thu, 30 Jan 2025 11:11:35 +0000 (UTC) X-FDA: 83063852550.18.AB0DD4E Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf29.hostedemail.com (Postfix) with ESMTP id DAC2B12000E for ; Thu, 30 Jan 2025 11:11:33 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=dAORmHbS; spf=pass (imf29.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=1738235493; 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=Q/yW7cYsxX6u2D6RjpsktMUNNjtmh2H6QDs8XtL+Hec=; b=ZF86eOQljjntAH+iC31FaeiMTbDG3uOu7gCLOs7jpvof1d5aRSEW+J//MqhQvF0aSZqzhz 1RySFh1t5j8K+0fhLpHm8fwAFDG9eJFF19vYMvTuhYIz+BtpeQXytqo8nwC3p8YyvqTpOJ 3RSd6KYyMqjE27ApZ0epauTMIFnLhwo= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=dAORmHbS; spf=pass (imf29.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738235494; a=rsa-sha256; cv=none; b=JvGZLEwWF5EDgdiqFUwwdXNgtTC7Rm8SCJU8RUhU4Clrggy47Yo5UqwEgz8PBfijwikALx CutF8TJVLz/4leTLP/ri0Mq+yLsT+RwSOYmXx5PCv8QhDNzJpnQJ26R+MpzZH+NAfPv/Ag fPcd9ifBnNY84lcGWCEIbU1gLcaFijw= Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-21ddb406f32so9766405ad.2 for ; Thu, 30 Jan 2025 03:11:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1738235492; x=1738840292; 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=Q/yW7cYsxX6u2D6RjpsktMUNNjtmh2H6QDs8XtL+Hec=; b=dAORmHbS43CMRTXVC6vOR7dtCsIYct1c2cLBjFfkk385e4YKZDBwVQ0WgQcBEQJl1J h86jma0DBxJaazgnMmWIP+sQxOmvPRhbFtYY6PqHaKTdbnQTv1rFg5ZHf9qCTydw8jlH 8mPbR7aga/RRdB6yJN1VGhIMaB96Kekbflt/I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738235492; x=1738840292; 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=Q/yW7cYsxX6u2D6RjpsktMUNNjtmh2H6QDs8XtL+Hec=; b=AWjyUxIGagoStlF70oba4yZfgCNl5aI/Pvm8e3JNF947VqufuzVpoOcnyZM9blPnh2 gjxa6jubSVkgXVb47UCPFDWuRva057ZUSTlZoI9Gctovzz8Da5dcM6fKx6/7bwAQP+h2 bMqkmFAtho3fKg2gSvmTvAchBWAdq2TVmoOmrgHAxxiQAeH9hE17s4zp4cPybP36RH2b rO96SvnnNr9Vd32R80g3U7QVafuGPNZIe9hoy8ZCbs6zJUyMATSED6q3KByCdhPH+ogJ HCbeG5Pi6aFS/oNFNe32IDWutyu7OAZEznKdlLue5Q+OV/vypOaGdSIWf8hSwQpirdCq nJBA== X-Forwarded-Encrypted: i=1; AJvYcCVTzOVPHJNAQYkpuSg2/+Q0zPlnboXhbT4/XZycnIPmFsFERyrWFUCMnK27xYvvJOAh6RPwyhQa8w==@kvack.org X-Gm-Message-State: AOJu0Ywukw72ZWrjjS2orvS8ikeNu3X87iA2NW59jRI5ssL+RCGq5g28 qguGCQhMU3E87FZ7cZ40U1KMbrutqDEwIGmJdgq7Ay0riJu/ODsg5JCq3vodPQ== X-Gm-Gg: ASbGnctjQ8nc9f4BJ2gKI3U618rwz0G2hruMtmimieJfmxSSeAiQ5nie0f/PYP5cbxf 5prJijCiLP+VZN9s62C4yhBExtREU1B/0Nk6oZTibYCZyRol340CjMO9KxC2DvbDEBmyHX93WNp q9bctuPxHf1qpMV7+dFnj2BIhDuqciDNctOu+xRD2x/uG/IBlrFun8eokBPoRjcg44a3C1UVZfQ UfKr8gFhunVYuk/YXdSGneqENIAfxr23pKftSiPWc9jUtzkZ6vS1IohS909oY81KwF32aYcozrO Hb22sYP8+99T4WFk X-Google-Smtp-Source: AGHT+IHRhQXy77fDs2DUj5z16q9LiSjBM8lSRxMlB0gLWnyP7Ox6pdNXNxWqKncG1n2YwlehavUUvA== X-Received: by 2002:a17:902:d485:b0:216:4853:4c0b with SMTP id d9443c01a7336-21dd7deef0bmr99162575ad.33.1738235492597; Thu, 30 Jan 2025 03:11:32 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:d4ce:e744:f46b:4fb]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-21de3302e63sm11331925ad.172.2025.01.30.03.11.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jan 2025 03:11:32 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton Cc: Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv3 04/11] zram: remove max_comp_streams device attr Date: Thu, 30 Jan 2025 20:10:49 +0900 Message-ID: <20250130111105.2861324-5-senozhatsky@chromium.org> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog In-Reply-To: <20250130111105.2861324-1-senozhatsky@chromium.org> References: <20250130111105.2861324-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: DAC2B12000E X-Stat-Signature: z4z57m6nejkxrnmscsa5rncautk4pcs1 X-Rspamd-Server: rspam08 X-Rspam-User: X-HE-Tag: 1738235493-313902 X-HE-Meta: U2FsdGVkX18DSFPuYzhFFaPtF3g8Glfsi0GDUuu5lLM7AGCq3/4Z53HnfDgL08jsPSCbr0sCPkhIR1EybLfYs93lKpxk6USxyTVlXwWQY7omlw2Aq1lXriXf/cjRa3ld7AliQlxub6cKnE0CGPBu1MpY7FBqWfSVm7Pt6ummMX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lh8YIEOVjrRpeH0cSzXeQNwsGnC10YRUB9QIheTIpctxTr8vZrn/uPLbvRFG9W5nA6cfUFakfKK0XJmkU/HbkvEH9zCv8dat9aSyXjuHR5100UdD7Gi1deHKQUzpZc6 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 31b653ad6d0e..0c9b68fa8783 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1096,27 +1096,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 */ @@ -2535,7 +2514,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); @@ -2557,7 +2535,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,