From patchwork Fri Jan 31 09:06:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13955130 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 6A62DC0218D for ; Fri, 31 Jan 2025 09:07:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 026D62800F0; Fri, 31 Jan 2025 04:07:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F19F52800EF; Fri, 31 Jan 2025 04:07:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBB0B2800F0; Fri, 31 Jan 2025 04:07:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BA70C2800EF for ; Fri, 31 Jan 2025 04:07:24 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7B319A089B for ; Fri, 31 Jan 2025 09:07:24 +0000 (UTC) X-FDA: 83067168408.25.E50CDF4 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf19.hostedemail.com (Postfix) with ESMTP id 8A9451A0004 for ; Fri, 31 Jan 2025 09:07:22 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=dkRDQ2O9; spf=pass (imf19.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.50 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=1738314442; 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=TXbFDLYuuOhKufVYkqbgI//dvCPqRmfyGlKUIOvD+TU=; b=6UNCiz+bzvxWXhetPsPHoiKStK062+TqqpGNRJLqc/Id3OdqYAgNZFUl+XJvuWyNQqiBFP YB28a2J7qnxYy2+jXmOqmpTm2DA+5j9N/0WIKvQJp6u2PcuUHEdhJ2HyFzv7rao+2SKbLd Ea4dPtX5/zQpQru8DhHMNcz1DY/WGYA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=dkRDQ2O9; spf=pass (imf19.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.50 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=1738314442; a=rsa-sha256; cv=none; b=exuiWwjnC7DGR80md1zEzJ3/VjxRhssgHJJF5i0H01iUbtcPL6Isvi0d7xgp5cD4WX9q1v UufkgyRtRYtmRtwxRdF2788sQeYxYKuTXT9SSvuCnfkJyB2SkNufm+yKYAsglr8A9ABSJA an8RzyG74q5l5brNGrDidFNR++X6EXs= Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-2f13acbe29bso4435079a91.1 for ; Fri, 31 Jan 2025 01:07:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1738314441; x=1738919241; 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=TXbFDLYuuOhKufVYkqbgI//dvCPqRmfyGlKUIOvD+TU=; b=dkRDQ2O9xLDu8ISvnIPhgNapABFztkyD/TOR7O71Yx0yYixH05fPdrtWv5xBxl9UQ3 nMgDwQh3maugSyxfh2DEgrSTRB1TKmrDvED1p5h1s/8l13Q36I2Q5SvzRuhKpLP/hFNz tAoVFOEfSBk85e9hzDHOS2o3eNx4TgvIid4YE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738314441; x=1738919241; 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=TXbFDLYuuOhKufVYkqbgI//dvCPqRmfyGlKUIOvD+TU=; b=femiRqp6wDR08tWf5tbf5lptMHnpRFD+7byAuiF0+oCl/ENaEGmpJOjvBlXwdZ29RM eYu5ihha6HMLfhUewNiIxlB4m82gwZlGu6c6Gd/t+qjP8ZIjLc3o3yI88e53C92bWPgl YyJtuVjc9SUVy8ZR07/DGWzev/RmPsBpg1iiBObh36FHx+FqAUB+V21LrwGga5Yf2gKG Zz1MjqZ0Ayk8gCYcahxRX2fm1D8ETygXFWMkNg2Nm9R+ZB+NpQBvXF/tcrfGJcOdlfxi IxlFU1PzZ3bT3wRX0bDwUNFvIgBsRI/dgs+4K8gcxqCLcNKR7NZXgDsLu9qjkE+fEqiB eaOw== X-Forwarded-Encrypted: i=1; AJvYcCW2Vg0a5El1q3A3k1PzosJF67Nl4I7Dix/ImC4likFujZ0BeLCqPVnflI/pPNymzvEi017K4x25Eg==@kvack.org X-Gm-Message-State: AOJu0Yx9UYTo+f3CM38gXCR1MkVBy3dUF66mlod+u488ZOKMVTw++ER+ 6v3v8BwZiAfuWzstQAFv5FFWCuiAlU7LdGrxWulrG9JUctyCZacpc9GjWKpetoBSOJ3PCyGcbfQ = X-Gm-Gg: ASbGncsxU1YLwOdvFjx6xIHGuv+n0xUdC3LEWHfU6L8JHbkmHPLLT/8wHaM1xdNyU05 RwQl95dhIfqALCR0J1vwVhDV8iL9dtPS939HMbrpoqFCWERavR2IQ84b2HY7sn7XuNkoqn5w95w vYstznFJFJwv4Y3WwhjF8lI751KVp8rdKq/gl9jQjXc3w4z8RxM18dLMi2PiP6zYljuCZMpgCb9 Okzr28ENnARc/W/weiPNpwWr97ZDg+dbZYLB2AWYBucPrqkytDSvuYOpXU2Ytu1F6bdB2WZg+NZ n8vVN9ibsndtLaRiKQ== X-Google-Smtp-Source: AGHT+IEKH7u2FXrx6jWcyNcJb/PaxSPMsTyCbU1VktjzxFUwBwz+4J7kQF6itN5PPT+0HWOIKATLLw== X-Received: by 2002:a17:90b:2dc7:b0:2ee:9229:e4bd with SMTP id 98e67ed59e1d1-2f84633eaeemr10228618a91.2.1738314440902; Fri, 31 Jan 2025 01:07:20 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:c752:be9d:3368:16fa]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2f83bccd590sm5442929a91.12.2025.01.31.01.07.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 31 Jan 2025 01:07:20 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton Cc: Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv4 04/17] zram: remove max_comp_streams device attr Date: Fri, 31 Jan 2025 18:06:03 +0900 Message-ID: <20250131090658.3386285-5-senozhatsky@chromium.org> X-Mailer: git-send-email 2.48.1.362.g079036d154-goog In-Reply-To: <20250131090658.3386285-1-senozhatsky@chromium.org> References: <20250131090658.3386285-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8A9451A0004 X-Stat-Signature: 43uramues5pmsr5cbo3npu8w9gm11ds6 X-Rspam-User: X-HE-Tag: 1738314442-771775 X-HE-Meta: U2FsdGVkX18laiEaYiSehOUhvuV6IHgkngjYT6vEn81BgVUQlg5lcGlTAj9Pc6P9G/RWSeh3Uo8ggEeFe0zbpPcZz4mtoqz0NEkB7c9b1JTasJSr+3deNazV/RTa7Tzh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/+X5f59gSeT1wnJdLDfGwsK4bmqfq2norixWe80M6fWBQwBx+rb8iBB8ZzNWu6RnXkfMIjffFgi2DzRT2QexPAAUEaeV4Tfr1mt8e9G5McNZiS+dIV1M43ObPnmR0qWB5R0IRAynqo3rTRHduVMwKp+fA7kYr9WDyRhJsWlXRu 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 6239fcc340b6..dd987e3942c7 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 */ @@ -2533,7 +2512,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); @@ -2555,7 +2533,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,