From patchwork Wed Sep 4 23:33:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13791487 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 44613CD4F4C for ; Wed, 4 Sep 2024 23:33:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 925D78D0007; Wed, 4 Sep 2024 19:33:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8AD588D0001; Wed, 4 Sep 2024 19:33:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B0D08D0007; Wed, 4 Sep 2024 19:33:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3F8F08D0001 for ; Wed, 4 Sep 2024 19:33:50 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DB72F1C6395 for ; Wed, 4 Sep 2024 23:33:49 +0000 (UTC) X-FDA: 82528660578.23.AFDB429 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf16.hostedemail.com (Postfix) with ESMTP id 28D96180003 for ; Wed, 4 Sep 2024 23:33:46 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=pVWc7D7C; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf16.hostedemail.com: domain of 3We7YZgoKCNYQGKJQ29E658GG8D6.4GEDAFMP-EECN24C.GJ8@flex--yosryahmed.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3We7YZgoKCNYQGKJQ29E658GG8D6.4GEDAFMP-EECN24C.GJ8@flex--yosryahmed.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725492756; a=rsa-sha256; cv=none; b=TKaXRBLYVFGfaeW8zEnl1xlVrhQeAlGeV6lG/7/6SanzGMkSNOpH+SRpBMNour4XS5At4U cllPmUxDZl0iWlQTPbCgXz9htvLz0p8u9PtNiwHzY+lwKsm24ybR21y2Xg7DQzv2XsnZGA j7agM6ueh5DmrluDiC9zZXris2DSpIo= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=pVWc7D7C; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf16.hostedemail.com: domain of 3We7YZgoKCNYQGKJQ29E658GG8D6.4GEDAFMP-EECN24C.GJ8@flex--yosryahmed.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3We7YZgoKCNYQGKJQ29E658GG8D6.4GEDAFMP-EECN24C.GJ8@flex--yosryahmed.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725492756; 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=uykNh/T0V9CAowhkC/wpCZl/aNMVHh9r5kx7pi77vV0=; b=SC1T3j2JvjndDfsD5fWbrb4KFtPNeE8cWfHAsc4Uz/O+RNwkabmUnq055s6QmahmT8e0RN blXqv/NM+AjVcgnPTVyMaXsvGXxCxrYCwf626yU5Wy8pxD41X/bz7ogk4YuzWwHzEL9O+9 uJP8yrrhNeBYFXqU1BtkLzjdTJ/3OQc= Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e1a7fd2eb36so448341276.0 for ; Wed, 04 Sep 2024 16:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1725492826; x=1726097626; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=uykNh/T0V9CAowhkC/wpCZl/aNMVHh9r5kx7pi77vV0=; b=pVWc7D7CUBOLiomnL3Sm2tWmHyvMWRH2+mCcLpQDdpiMl37sO9D7ynT68SfwQK8g1I hmQ6oMIhGtPm9QO99BEkhoJ8GS4vIVKqIeiSWqM0pGcbK0bd4ZERiVpEomEMECaIPfyh 6uDq7t9Qbs0m/QsqqUS71r6fnw1mGkp4F8O0yUgaA3iGHzGtxxs3KBvrhilomHmRnNLZ P91ln7WQ49U3gROfhIyUhYSzZ5DxMMOLX8uZXnwriw3mme5Tnlvr2jyab8Xv/Eqq04+L bzaTYxer93v9AA4GsXPBOWpGm5xkGidKxPoqsJpA7nvV1HqbTaP5z5IJN6TrIifFOfZh JKkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725492826; x=1726097626; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=uykNh/T0V9CAowhkC/wpCZl/aNMVHh9r5kx7pi77vV0=; b=Pi+yCzHyc4IS08O1nJ/tf4Vg9ADf5oN3HTFZ590SMYwtrIdjMEcr79Kxnhepl/rMTc bN0L6By4OhhxCXyEfMUUUJOFNo9eR6MzG2KNQHErfxfypFc7hZg8iA+GvmY70e2Q5q8W j3aNMg/3ust5NtIW1TR3smSKr1bQMWHGw07ck9r7CDlqm2JPydQXdKDt9OOtJ1zusHYH +R0h4RUfSavhBl/KJCIbY6KLxYJ/jxnDNR/MO1mPJCl1FiAnaTsxWQ1k2LtqfmOE9nr5 dPNj24orpfGsuaQ0rF0OyKi1D/Z93ZwJHDdp5ZXlYB+uiUGZQefTOZjEar9BXHLkQ6w2 XmFg== X-Forwarded-Encrypted: i=1; AJvYcCU8mwM6BX1LNRoYcPJp2eqV/W9pmthbThQeE/A5SMhg+LQ3HViU1xHk52AW3V2E0kOQf+Sa7BPrZQ==@kvack.org X-Gm-Message-State: AOJu0YyIxuudWafalxwSrGbEeYdwXtsgAVOvkxpdIonUxt2EpPD7YZmT iuK7H9BWPYG9AZFMUIc19Q6EWQLl7Ws906QifvpnNvmojhqQkSaNfNljVJF99metrMwZRiRayoL xN6uuSVhzw1fsFjj7tQ== X-Google-Smtp-Source: AGHT+IHlWubTx6E8VrUfQXTNNaZkLgFaN+lTCKP4pMLyXKpV+FgOVAlLsacWjKzs0BxCPS5/R97jnhWicwTPqmYJ X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a25:8592:0:b0:e0e:c9bc:3206 with SMTP id 3f1490d57ef6-e1d0e78ad12mr5832276.5.1725492825962; Wed, 04 Sep 2024 16:33:45 -0700 (PDT) Date: Wed, 4 Sep 2024 23:33:43 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.46.0.469.g59c65b2a67-goog Message-ID: <20240904233343.933462-1-yosryahmed@google.com> Subject: [PATCH v2] mm: z3fold: deprecate CONFIG_Z3FOLD From: Yosry Ahmed To: Andrew Morton Cc: Vitaly Wool , Miaohe Lin , Johannes Weiner , Nhat Pham , Huacai Chen , WANG Xuerui , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , Christoph Hellwig , Sergey Senozhatsky , Chris Down , loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Rspamd-Queue-Id: 28D96180003 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 55gt5huyczkftsnw6ou476qy6xirkt6n X-HE-Tag: 1725492826-791059 X-HE-Meta: U2FsdGVkX19Xf58R+Dn8j1+Ox0qnH1yDh/vvfXd4oxxVJiCPJ1Yyfax6lr6lvY3l4iTUkvh9kM1mDc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FQMI6wMOhvu0tdzh0wG3qGUTBDd3QnX5/dNqIqR81GrvB747PKBEguS3WTjEC9o9pfyKLdV3eGGqCvSUaydiZbQ8x+VKXxTF+6F8Im0VayK2xWUoZCIWanHrW6CcaGmMlhRxOO7Np5mm54V8V0ZdfST+Hq7OKUCWf5nmjcjELzSQsxFZQwM5bvLnri3BNFeikVj5wX8pR/N8qgTZTOciMksIo7QgTTdd6DmB//G13rnnT6Rigg7ri06+FkJd+lQqdG936u+3mAnCOJThDaaN8CIEwGMg6W9bGk4oPMY6tzXvKoQQ1UqyeguL43hg8m2RyVsZK03M3XyFLc51dIl2iPTpn+2TGycvv30XzVVLzex7CmVrGCrzxFhVXeRMcQ/mk4vXUo3Y+u2YeMn4mQ56e9fLsuitahRkpmwWl3ba+Z+vnQx2fkF8awcW3le+ZEOZMg3n3nnSb4SZqj5CV1tWCf1dX7gz6WzpiTFPhJwNrBzA7LWlZhMWv146RPto63i+LRzitwv/x19vC8L3+gIEO8DMTiZXu/PR8UxaFIP7D6FBiuoUXJ 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 z3fold compressed pages allocator is rarely used, most users use zsmalloc. The only disadvantage of zsmalloc in comparison is the dependency on MMU, and zbud is a more common option for !MMU as it was the default zswap allocator for a long time. Historically, zsmalloc had 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]. That analysis showed that z3fold does not have any advantage over zsmalloc or zbud considering both performance and memory usage. In a kernel build test on tmpfs in a limited cgroup, z3fold took 3% more time and used 1.8% more memory. The latency of zswap_load() was 7% higher, and that of zswap_store() was 10% higher. Zsmalloc is better in all metrics. Moreover, z3fold apparently has latent bugs, which was made noticeable by a recent soft lockup bug report with z3fold [2]. Switching to zsmalloc not only fixed the problem, but also reduced the swap usage from 6~8G to 1~2G. Other users have also reported being bitten by mistakenly enabling z3fold. Other than hurting users, z3fold is repeatedly causing wasted engineering effort. Apart from investigating the above bug, it came up in multiple development discussions (e.g. [3]) as something we need to handle, when there aren't any legit users (at least not intentionally). The natural course of action is to deprecate z3fold, and remove in a few cycles if no objections are raised from active users. Next on the list should be zbud, as it offers marginal latency gains at the cost of huge memory waste when compared to zsmalloc. That one will need to wait until zsmalloc does not depend on MMU. Rename the user-visible config option from CONFIG_Z3FOLD to CONFIG_Z3FOLD_DEPRECATED so that users with CONFIG_Z3FOLD=y get a new prompt with explanation during make oldconfig. Also, remove CONFIG_Z3FOLD=y from defconfigs. [1]https://lore.kernel.org/lkml/CAJD7tkbRF6od-2x_L8-A1QL3=2Ww13sCj4S3i4bNndqF+3+_Vg@mail.gmail.com/ [2]https://lore.kernel.org/lkml/EF0ABD3E-A239-4111-A8AB-5C442E759CF3@gmail.com/ [3]https://lore.kernel.org/lkml/CAJD7tkbnmeVugfunffSovJf9FAgy9rhBVt_tx=nxUveLUfqVsA@mail.gmail.com/ Acked-by: Chris Down Acked-by: Nhat Pham Signed-off-by: Yosry Ahmed Acked-by: Johannes Weiner Acked-by: Vitaly Wool Reviewed-by: Miaohe Lin Acked-by: Christoph Hellwig --- I think it should actually be fine to remove z3fold without deprecating it first, but I am doing the due diligence. v1: https://lore.kernel.org/linux-mm/20240112193103.3798287-1-yosryahmed@google.com/ v1 -> v2: - Make CONFIG_Z3FOLD_DEPRECATED a tristate option to match CONFIG_Z3FOLD. - Update commit subject and log. --- arch/loongarch/configs/loongson3_defconfig | 1 - arch/powerpc/configs/ppc64_defconfig | 1 - mm/Kconfig | 14 ++++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig index b4252c357c8e2..75b366407a60a 100644 --- a/arch/loongarch/configs/loongson3_defconfig +++ b/arch/loongarch/configs/loongson3_defconfig @@ -96,7 +96,6 @@ CONFIG_ZPOOL=y CONFIG_ZSWAP=y CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD=y CONFIG_ZBUD=y -CONFIG_Z3FOLD=y CONFIG_ZSMALLOC=m # CONFIG_COMPAT_BRK is not set CONFIG_MEMORY_HOTPLUG=y diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig index 544a65fda77bc..d39284489aa26 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig @@ -81,7 +81,6 @@ CONFIG_MODULE_SIG_SHA512=y CONFIG_PARTITION_ADVANCED=y CONFIG_BINFMT_MISC=m CONFIG_ZSWAP=y -CONFIG_Z3FOLD=y CONFIG_ZSMALLOC=y # CONFIG_SLAB_MERGE_DEFAULT is not set CONFIG_SLAB_FREELIST_RANDOM=y diff --git a/mm/Kconfig b/mm/Kconfig index b23913d4e47e2..536679d726417 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -177,15 +177,25 @@ config ZBUD deterministic reclaim properties that make it preferable to a higher density approach when reclaim will be used. -config Z3FOLD - tristate "3:1 compression allocator (z3fold)" +config Z3FOLD_DEPRECATED + tristate "3:1 compression allocator (z3fold) (DEPRECATED)" depends on ZSWAP help + Deprecated and scheduled for removal in a few cycles. If you have + a good reason for using Z3FOLD 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 three compressed pages per physical page. It is a ZBUD derivative so the simplicity and determinism are still there. +config Z3FOLD + tristate + default y if Z3FOLD_DEPRECATED=y + default m if Z3FOLD_DEPRECATED=m + depends on Z3FOLD_DEPRECATED + config ZSMALLOC tristate prompt "N:1 compression allocator (zsmalloc)" if ZSWAP