From patchwork Mon Jan 27 07:29:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13951024 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 A2D86C0218F for ; Mon, 27 Jan 2025 07:30:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A89E280124; Mon, 27 Jan 2025 02:30:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 25AA02800DA; Mon, 27 Jan 2025 02:30:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D2C2280124; Mon, 27 Jan 2025 02:30:04 -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 D94BF2800DA for ; Mon, 27 Jan 2025 02:30:03 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 95FF3AE3F5 for ; Mon, 27 Jan 2025 07:30:03 +0000 (UTC) X-FDA: 83052407886.02.F92670B Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf23.hostedemail.com (Postfix) with ESMTP id BD65714000D for ; Mon, 27 Jan 2025 07:30:01 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=MSsPWciZ; spf=pass (imf23.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.171 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=1737963001; 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=lUvRyh0me1bXpwqfK+TRyFS4H2+UkCD7EBcpdcldqV8=; b=s5i0mndaAY5Bz+G/LE37gNmnWlnKkuYAOAAb24il0pXBPXTW7YTNVrO3ez6mZs83V2xzIR QeLQy8ElQMBxZnloho+AMXEFQE1X/3xYYTvXFfRped9PkFQdb97FD1gOqdX+wdcrid59yg Jl0csxSobNa2HYkbyPzPvRWB+CIB6MY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737963001; a=rsa-sha256; cv=none; b=y9/obj6iBeHF3e9RtPzvnVENY9px/4260WyTWcDCbTpI5xE6Q98AqS5Z22Hy7jBc1EtVQo 1CO+8vwSTgVyi/pTi1lvsDwsaB4wZ8bXAZ+s5jGyasuuNfHb1K/Zj1Y9ozscGDcMoHnKWG zfH1YWPX8LbZOW0iPv+DIkUhxXEJv1I= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=MSsPWciZ; spf=pass (imf23.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.171 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-21675fd60feso90565215ad.2 for ; Sun, 26 Jan 2025 23:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1737963000; x=1738567800; 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=lUvRyh0me1bXpwqfK+TRyFS4H2+UkCD7EBcpdcldqV8=; b=MSsPWciZbSqSu8ngY9/E0Gb8hKsVFEar/dKQ7MSn9GuN4yTqItsR+RDSDd0VP0/C2r cNCy+v70LPeNJe8TyxnD08U6rWu0XyoFqo2saBBfPMHVqeLBrTX4xYxp2BALUu8eb9/9 MAawD28xTsA/WcuqjT+ArGGhtNHYw8y8Mg+pg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737963000; x=1738567800; 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=lUvRyh0me1bXpwqfK+TRyFS4H2+UkCD7EBcpdcldqV8=; b=cV97Jl68Nsy5kK3tJq0xdtcA7W6YQyHkdCXYW+fNy5I2M4MvIGAJgYnpsnsw4BO5zl EI1MKDdmeK0RXTM/UW7ZWV92Q08k/zrixEd9u7M/4HBFQRb14Rz2ixWMltNeMOmQoeIh i1MNYItvSwPMQ/1tCI12J+Zejnit/agyLzSu48J6gyi5LOdlH0qGAOTPiuTSpONIXrhS RzRRcvHs4uJg0VvZ7xLUt6h/928VAyj01fbZ4qSXDfqq2qCZlFypYxjs0kFroP4KIbBs 0sfvOiYULgbwJal9SJnv2j3braj79DtZXam2LoHYx+bhoE38dvc4/ZvHcdfHV2rVKFNH WJVg== X-Gm-Message-State: AOJu0YwV1+Q/YwIjYHuNl/Y5MiC1OoxbdplFcsN/QE0PZtN6IMEXV8nX Ox6FLpDRBka39ICt3Kmea9yLxnOdPyG90A5G2e5Bg3GRmZ9lGORUX5Ezw1pGrw== X-Gm-Gg: ASbGncuwjXLrdycvPXyVTpNPgJAUzaGT+SLBkXJpszrWoPc4c2ZcZHfTMtDcVMTD3wO YTA0NK39bQw5ckEs84aCFG6uWpCq0pWNFiduwdk0/63hTj2X7pW6lLedDAVAT8xVBdmlBTo/OEN 3qIQtnrHGishCxUWFs3BDFTTeMLZU2xpfm9f/cEqkl5Ne+2VuD20BhRQiosHUN/docIwknqyBp/ 7aQcAjPr84jc06YzAHcIPAjGg/KD6nkbsfXHOmmFAu88jfjxdxeiOVoEnuugxVETgmqtfRNeWso 1EoAocA= X-Google-Smtp-Source: AGHT+IEMZNai1/9yM8pfA7fL3mLUFYeR0CMWjd6TA0xHnzwmsWa0/+qcJq0oMDnr/ZCTRC5XkIHMLQ== X-Received: by 2002:a17:902:ea03:b0:219:d28a:ca23 with SMTP id d9443c01a7336-21c355eea74mr607842355ad.36.1737963000524; Sun, 26 Jan 2025 23:30:00 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:566d:6152:c049:8d3a]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-21da424e779sm56851105ad.213.2025.01.26.23.29.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2025 23:30:00 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv2 4/9] zram: remove max_comp_streams device attr Date: Mon, 27 Jan 2025 16:29:15 +0900 Message-ID: <20250127072932.1289973-5-senozhatsky@chromium.org> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog In-Reply-To: <20250127072932.1289973-1-senozhatsky@chromium.org> References: <20250127072932.1289973-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Stat-Signature: skg159jzwbbmtydduhmgdrnkpzqo3ggs X-Rspam-User: X-Rspamd-Queue-Id: BD65714000D X-Rspamd-Server: rspam03 X-HE-Tag: 1737963001-281933 X-HE-Meta: U2FsdGVkX19ChYXJY03F/FXJC3e/SpgJLUmR7mfnEO9w3sihF4oEliExoMH6bNCRxo3w3SIN2yb0Gk4K9t+/i7hMXU2nJ3MOvG9sEcLvBNWkXJoOy6XiiI810HvPIGfoht4MgwSGy+cYAer06E1i0tTheN53bzaZ+eQFUiw7qdV/UcVzhvYjnBsfgi7YVeI1kvPOEh54LfsGvhWEPnRzE1QHVvlXQVgZSDoXg4hgTGLHEpjoWqNRcSXslfAuNTUrS3lrBMTHQw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8fBFuwq57q3FSTsyWye7Ysa4CuLUim0pD4Poh/x6EnFRtCt/mv9e/F6v0kn 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 c1ecaac0b39f..d867e15d1d2e 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 */ @@ -2542,7 +2521,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); @@ -2564,7 +2542,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,