From patchwork Mon Jan 27 23:58:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13951916 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 41D7BC0218A for ; Mon, 27 Jan 2025 23:58:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEADE2801D2; Mon, 27 Jan 2025 18:58:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B9B652801D0; Mon, 27 Jan 2025 18:58:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3BAC2801D2; Mon, 27 Jan 2025 18:58:29 -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 82E802801D0 for ; Mon, 27 Jan 2025 18:58:29 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3C644808BE for ; Mon, 27 Jan 2025 23:58:29 +0000 (UTC) X-FDA: 83054898738.13.F98A2B5 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) by imf22.hostedemail.com (Postfix) with ESMTP id 93765C0002 for ; Mon, 27 Jan 2025 23:58:27 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=mop0t27e; spf=pass (imf22.hostedemail.com: domain of yosry.ahmed@linux.dev designates 95.215.58.188 as permitted sender) smtp.mailfrom=yosry.ahmed@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738022307; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=EPs2Uumgwh7vfBYo0WttnFq3NwRPbFFMOoiBXTDN20M=; b=kila7wj2CVQWwxV66eucoKb83mPBnegsoI7OgoSYx8Dl0LtFy4qJUtUM6Z2goUHOxVJRtC GPyHNj7hFGmqhcAysuJumY8nBreQVUGZfkgKNMUZlq1FkOk7q6xAj+49DkMKN3uB7pNi57 SvXSrNiJ1DR6hM4xR+zBaiWCXr2Lmog= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=mop0t27e; spf=pass (imf22.hostedemail.com: domain of yosry.ahmed@linux.dev designates 95.215.58.188 as permitted sender) smtp.mailfrom=yosry.ahmed@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738022307; a=rsa-sha256; cv=none; b=1WwPD9UL08Gm9sqORPEM52uDuKgdgAU6GC/7jxbLA+QntS99M80Du0pIwLyP8EkV65b8UF TEoGsOoLsV5L9Dh4Yve8aXftRt1XETyOc4g/3WwqDZGkgSKCwaLDThxm1sjGQxECKF5E+o 3+6eHMtGL6kFTkGMPqU/qo9zySu1wA0= Date: Mon, 27 Jan 2025 23:58:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1738022306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=EPs2Uumgwh7vfBYo0WttnFq3NwRPbFFMOoiBXTDN20M=; b=mop0t27e59d7Z63k1Y1+pYSX8oRmad5uJCwuZSkAt0858KbChIwYTDFFj3IEuwwnl0VIrb jOYSA3Y+YBa8rXiIfZSBW6G6Kvppy6PkrvENViR+lCFK7xQbnoLW7M7CBGUvscRC2OC8vy k9sT3EmvzEKtp5vPYDJ1TRXiSOhgMhg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yosry Ahmed To: Andrew Morton Cc: Vitaly Wool , Miaohe Lin , Johannes Weiner , Nhat Pham , Chengming Zhou , Huacai Chen , WANG Xuerui , linux-mm@kvack.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev Subject: [PATCH 1/2] mm: zbud: deprecate CONFIG_ZBUD Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 93765C0002 X-Stat-Signature: oku5n1prnbh34mjpef8djm8e7jfpdmy1 X-Rspam-User: X-HE-Tag: 1738022307-87811 X-HE-Meta: U2FsdGVkX1+yIXJgIOSavcyk0b8yVzE76sdqgrqpXzoZs51F2l7F+KykK//8PqUlyK7CdeA7V0zA25IYB1zosL9/Gl3DrcaNUc4zjQQxDuxVESO4QRibG81mH1on3lAHPoESbV2q1omVzPgk3SyrbwMV4r4Z4eIIC/pBLmRU8VO85BxRwZmJOwvPT9HKN4vFECatEk0DnHEdg1W21cbNqsNK3Z4lRCBUcKXonxDgEQETFcInBzI3CXZVG6Rjy0Y35DbzzqGlH2IFGEmklpUv6M95MofjxG1bG8czaRdqk5h6sLbp2JwPvgyAW6bkhQZCki+/a4JvberDPFDHNUlARWGQ9HtfcelTeETUzuYosMCsmkXdkpp0VvGVZhdc5h7kkD76PzkgDcXDADK/CLz3bFpHphaYKFiTtP2ssXGrIqNJa8+awClIqO23UZFWNz+NE6HE8ipnARLlPp2D44PVMq5kEuurCf0sZzad8oeAZS1Azo5GzxMHIRz+uFhjpFLamK6ZknRm4GEEUA5sbAlbx4i8mMxKbXPRC5KIPzCKUfhc31NJafGJnOKI1Way+3k3SG6I/VR1w8TytcBjZ1SxPBUEEv2TrgNLT23IXnXSnAd6YR8lFKk1XQAfafY4Mj0QW0GbHdj+mB7Cz49V8it0SVjr2Eennzog4aP8iokjnpjbMjNuuD8s6Otv4GM2dsfNFqGUQAC9OZUOA+YYkIClbjE3P4aP8EK6AE9BIu64P1u268/VOcKg+kpWrPb+9zYFFiPBfGQ0ZRwrkp6BpS3K/abKPoGMfo/3lKDiCOCX0k7R9O0RcJGKXqbEpxqsnX5maAoDeMvkb+fcaIMAILqw263OS5/HJSaN1VZfyjOdAnRwuGZkA8k2aWVwjbNZD5wfjZDLSawciXmzcDRVpRofgRBQoYDy0ryqCrFO4T+9x17x2P4SUZsbvZn4EIXkYd4V9GLQx29GxWQADwUQeAi bZ+BgRg/ EhtioBjmDEl8d3LciL4U+WxQ4e/Ctj6eR7RvQ8dXDazlPHOFvjOqs9YuYq8j61CDj7FcPpV5+QgY2Ihd7sVIhre7CtEmWs+6XOLnn7lnw8sDSlhH8NXYQLsIBFAC9MUGF3V6S9bOueiXxQMYJyVj+u0d+qRx1CsK1+KaKdAQ6IK6xjDJp9DnuPjheCRwFJ9fVWs3D1HCQuoOw5CY/wKDt9paT2Dsx4tc35NPzw2RjzDVnqtHCuEJ7xvTDcQ8wNNU7mM+L8uxRY3sGDVFxCSWI13k7SzkSTDN6D018DxWnISmLzcud3MyscNZWpcn44o0ohcYQNm/QMtSbqmQjMfzuUbqaDjVm5xT71NWgYLWe6gST2+E= 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: The zbud compressed pages allocator is rarely used, most users use zsmalloc. zbud consumes much more memory (only stores 1 or 2 compressed pages per physical page). The only advantage of zbud is a marginal performance improvement that by no means justify the memory overhead. Historically, zsmalloc had significantly worse latency than zbud and z3fold but offered better memory savings. This is no longer the case as shown by a simple recent analysis [1]. In a kernel build test on tmpfs in a limited cgroup, zbud 2-3% less time than zsmalloc, but at the cost of using ~32% more memory (1.5G vs 1.13G). The tradeoff does not make sense for zbud in any practical scenario. The only alleged advantage of zbud is not having the dependency on CONFIG_MMU, but CONFIG_SWAP already depends on CONFIG_MMU anyway, and zbud is only used by zswap. Following in the footsteps of [2], which deprecated z3fold, deprecated zbud as planned and remove it in a few cycles if no objections are raised from active users. Rename the user-visible config options so that users with CONFIG_ZBUD=y get a new prompt with explanation during make oldconfig. Also, remove CONFIG_ZBUD from defconfig. [1]https://lore.kernel.org/lkml/CAJD7tkbRF6od-2x_L8-A1QL3=2Ww13sCj4S3i4bNndqF+3+_Vg@mail.gmail.com/ [2]https://lore.kernel.org/lkml/20240904233343.933462-1-yosryahmed@google.com/ Signed-off-by: Yosry Ahmed Reviewed-by: Shakeel Butt Acked-by: Nhat Pham --- arch/loongarch/configs/loongson3_defconfig | 3 +-- mm/Kconfig | 26 ++++++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig index 73c77500ac467..7ce5beb3cbf34 100644 --- a/arch/loongarch/configs/loongson3_defconfig +++ b/arch/loongarch/configs/loongson3_defconfig @@ -109,8 +109,7 @@ CONFIG_BINFMT_MISC=m CONFIG_ZPOOL=y CONFIG_ZSWAP=y CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD=y -CONFIG_ZBUD=y -CONFIG_ZSMALLOC=m +CONFIG_ZSMALLOC=y # CONFIG_COMPAT_BRK is not set CONFIG_MEMORY_HOTPLUG=y # CONFIG_MHP_DEFAULT_ONLINE_TYPE_OFFLINE is not set diff --git a/mm/Kconfig b/mm/Kconfig index 1b501db064172..e3e15ab0cba49 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -129,7 +129,6 @@ choice prompt "Default allocator" depends on ZSWAP default ZSWAP_ZPOOL_DEFAULT_ZSMALLOC if MMU - default ZSWAP_ZPOOL_DEFAULT_ZBUD help Selects the default allocator for the compressed cache for swap pages. @@ -140,12 +139,15 @@ choice The selection made here can be overridden by using the kernel command line 'zswap.zpool=' option. -config ZSWAP_ZPOOL_DEFAULT_ZBUD - bool "zbud" - select ZBUD +config ZSWAP_ZPOOL_DEFAULT_ZBUD_DEPRECATED + bool "zbud (DEPRECATED)" + select ZBUD_DEPRECATED help Use the zbud allocator as the default allocator. + Deprecated and scheduled for removal in a few cycles, + see CONFIG_ZBUD_DEPRECATED. + config ZSWAP_ZPOOL_DEFAULT_Z3FOLD_DEPRECATED bool "z3foldi (DEPRECATED)" select Z3FOLD_DEPRECATED @@ -165,21 +167,31 @@ endchoice config ZSWAP_ZPOOL_DEFAULT string depends on ZSWAP - default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD + default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD_DEPRECATED default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD_DEPRECATED default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC default "" -config ZBUD - tristate "2:1 compression allocator (zbud)" +config ZBUD_DEPRECATED + tristate "2:1 compression allocator (zbud) (DEPRECATED)" depends on ZSWAP help + Deprecated and scheduled for removal in a few cycles. If you have + a good reason for using ZBUD over ZSMALLOC, please contact + linux-mm@kvack.org and the zswap maintainers. + A special purpose allocator for storing compressed pages. It is designed to store up to two compressed pages per physical page. While this design limits storage density, it has simple and deterministic reclaim properties that make it preferable to a higher density approach when reclaim will be used. +config ZBUD + tristate + default y if ZBUD_DEPRECATED=y + default m if ZBUD_DEPRECATED=m + depends on ZBUD_DEPRECATED + config Z3FOLD_DEPRECATED tristate "3:1 compression allocator (z3fold) (DEPRECATED)" depends on ZSWAP