From patchwork Fri Sep 8 23:51:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 13377923 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 04063EEB570 for ; Fri, 8 Sep 2023 23:51:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B7916B00AB; Fri, 8 Sep 2023 19:51:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 467376B00B7; Fri, 8 Sep 2023 19:51:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E0C06B00BE; Fri, 8 Sep 2023 19:51:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1CD1A6B00AB for ; Fri, 8 Sep 2023 19:51:19 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E5CD5B4716 for ; Fri, 8 Sep 2023 23:51:18 +0000 (UTC) X-FDA: 81215079036.25.066220B Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf08.hostedemail.com (Postfix) with ESMTP id 34B12160006 for ; Fri, 8 Sep 2023 23:51:16 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=POWKbyC2; spf=pass (imf08.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694217077; 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:references:dkim-signature; bh=aFPAFrw06YkFvcW1+oSEgoGL8va6uPxDJtsTprxSrLA=; b=oKh1Vc6rnbyKoNEzgrzGYOUW8V/YX8cyqwC8eCBedJFIXhdaxEnQFIqxvPGi2Q3cuMuNIL zn776BlaV3FKSqsVFyxTENvPPvEaDyhQKVPmFwISrzzuPS5Pz4rDuwm4xwqbLInPibzxJn kFr3mLgGB8c43q9GitbqD6B9qhk/zvc= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=POWKbyC2; spf=pass (imf08.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694217077; a=rsa-sha256; cv=none; b=6+1YGgE7IpLorcon+rSoKs90yw1a7hM8YAnDBZDbpjDtIYOrsC0lBwlk0hGcZra127G0yx 2sX7iMkB5eg2MMBtESYF389A3DSOpnePfxvzoEZBBvXninu61JbHFDi8x55npM5AkWLed6 EwW6iSPEJ7DaLYTaquywMlzMNP1gLlM= Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1c06f6f98c0so21437905ad.3 for ; Fri, 08 Sep 2023 16:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694217076; x=1694821876; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aFPAFrw06YkFvcW1+oSEgoGL8va6uPxDJtsTprxSrLA=; b=POWKbyC2pYspH3ln7HOmPxUeH3smBRlpZPUoy6x2bajpuK5rVqwJwQIbzrNgp6xmIx 8pbHceTRJz4b2JqbkE52i/xG4Nr94RL1pcorxkQH/gxyUF14qXOf4JWUDdjdz+SJ1eJT emVfvNxLbX1mc6jqeOkx45auLfFqfj0Szo5TYCFcV1haIAvjqpYWJBtWxu2Rb+pVJrgz /Qw/C2ZVB9oPIwv7qUlf2zq3eCY+EJS/fiHQs9+7ot9rmgRZ1I7sp3bGysB2o0DyAGTI hqekhWHs0JhGHkY8QWChdNg0srfgBB5e8DBAigB575lYUwaksIicseCtKRNSaOEjfnx1 EgXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694217076; x=1694821876; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aFPAFrw06YkFvcW1+oSEgoGL8va6uPxDJtsTprxSrLA=; b=hRbJ4UYktusam/EjxlRtN7OOTFzNCLJToq+0IG89f/obr8C23akrpR1xO6OZsZ4oBA wG2O7m8k3LIpBt3UhfrXfqpjYuaQ4BgSVU5bubla8VoLpnvVvpzM47OdfcAmpgd2Ux7l vBHjtmarFZvMrOHIXzCGsDprVR3iqVxIvh+saPE4WQ0uSjKJBZAO6nb5rP2JKyy2R34+ kXKKJDA2xzzHEhC7K5th2+wzGNolP5i49k4JDdr6E+k8BvNhg4q7o9fi1dZEEgm6Uj0y 2YeUqX6qzyDSuVHPf23Sv9MAa+SPfC2j5FRp4dEP75w4VZv6tn+bWXf0IjjOsGWxGLhX AMGA== X-Gm-Message-State: AOJu0YwbutIRN9RpuLn3UW9qn3rNVZebyWWNdos30G2ZxuI+TFmJcQeu DZgrYiPiuOiWReskYtVkNYo= X-Google-Smtp-Source: AGHT+IFRUIyM1m4pncJ0Nu19lRVBkqXyJ5X3NEe0F5euYr6EwYPMg5RyfxfpoUOAgB6jVFaykr/A1Q== X-Received: by 2002:a17:902:d505:b0:1bb:59da:77f8 with SMTP id b5-20020a170902d50500b001bb59da77f8mr4512905plg.48.1694217075894; Fri, 08 Sep 2023 16:51:15 -0700 (PDT) Received: from localhost (fwdproxy-prn-113.fbsv.net. [2a03:2880:ff:71::face:b00c]) by smtp.gmail.com with ESMTPSA id jf3-20020a170903268300b001bdc208ab82sm2117872plb.97.2023.09.08.16.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Sep 2023 16:51:15 -0700 (PDT) From: Nhat Pham To: akpm@linux-foundation.org Cc: hannes@cmpxchg.org, cerasuolodomenico@gmail.com, yosryahmed@google.com, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org Subject: [PATCH] zswap: change zswap's default allocator to zsmalloc Date: Fri, 8 Sep 2023 16:51:15 -0700 Message-Id: <20230908235115.2943486-1-nphamcs@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 34B12160006 X-Rspam-User: X-Stat-Signature: tu793j4gqwqxwu1k8d9f1rzzy6bx3rk4 X-Rspamd-Server: rspam01 X-HE-Tag: 1694217076-712465 X-HE-Meta: U2FsdGVkX1/KheyZ0fGcZaZC2OxUAURP3StTTu78DT2mm9es+wv4rSCz4OHdnZ2KprNPOb/tlULiXHgBHGjxrv0IbOrdCicjpIIgQL7jlKX/7RPLD+CSNzyHhiup8B/E61t/ELsEeb8oyFsJXC9hK1IYNbBtM+SHlchPZT82gybQC5eyDSVmvs0C2bxIDsUlX7Fq3YQ9oASK61EZ0rBLsLntyW6MUctSuScELjPQXEjUx8fWpGKV9/Tq6D0umXmZ7Q2IxCwQRt9FdsfDQFKB8ab1xSMq624RRysJUXHHYMyjpO5myujGTzkBzEnzZDe6dfRuJ2RJC7K99OiNUahVQ5nelfA8uCLgTIyYgUfzWd7NmRTpEDDjsR3J8oq0KsFzUrm6I//0ucZ0hOCsAbliTvgyVTpIcJ/daoeJOKhTcHdqD1Z5vxVc6Il6gUgptvse6f3qh2joXWn5hGYTv9ZB3o1mFlw0kb3bzDriUoFWN74auGOxsq9STLds4BUcYyBRue44xUpMjH/tOGMcXERNzohViP5EiRbuG1bwe3AWPiJqhX8mgDzCbwVYgtXFe0VVoKn8WGfHtD1ySqYqKfY5dm/c/biHcNnddYHECFL8Nev+eQM4sEBpXwP+HvyPRn8SAstmopzg262RuEQr62TzxY462xwWc5+dNyOFdsncNlNL1JAlFyDfxs4NtLwfvzcoIcnu2ToVMHsknAcyMZ75Tf66IKHSd5ctdXJ5+FssJoziDQceHBTzVhAwpDMb1QcsFIP1yYTGVlgPDRu4aqBA3ILJaNfJ7sY9QZBnv+Pm3wiM+ufcSEFQw8Wwzc0g/y1cS8SEyaics5TyjHc3QJW1zKQSjK3aRnc6TbFKusxjqdFxOTS3uQqQpQ7/4ovaKl0cMAw4pB3HEWrXIZMB7rMiuxNiCos0ISLT5dOu5PV3YV1C8d0bHF9X4cWbPLbYs/gLXaPIfmYbpFP6TQjK25x BpRUy8iO EL5q1HiIdEUJ1YsLqYMAM72miD0RteglWjb/p8RmpWUYHHHVo25SixZ7C/i0J2iqBiV+7ilb/hVJDrz2TYllJpM8tgm8Y5SWUbSkannhgEWbzP5ESNvNzcD3De1cNr8QTciBcaTVLot4xeDAmjuQJ1MaHLl180RxjfbHAeEh6R7R8GVuUKpgtiFK4aCLYD2aE+epf1XK/59K8BGkl/tFIEyFfpZgYvUzMAXMvxMqPE0Q8hJTUiETkNfNNRaaEEGiDedC1Pl4xWticnedeg3ToMjUp1PCgOBGQV0R0c7c6KZkVzGefLNFDpU9+521qC/y6wmRBncNPNu4W0qbrwp994xbcmnzpbosaK0HWrkVqg7UAkURqp0jB7zcCALb4e9BfeaCvDwbGeJWD35gHdSiqBnHYHASzKY+jepmfZn7LbdmfPmyfRAaMiYOll2sWeNic3BamwSBPAUAMJTajGpYXXgJbgx2rMMpRCB5Y 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: Out of zswap's 3 allocators, zsmalloc is the clear superior in terms of memory utilization, both in theory and as observed in practice, with its high storage density and low internal fragmentation. zsmalloc is also more actively developed and maintained, since it is the allocator of choice for zswap for many users, as well as the only allocator for zram. A historical objection to the selection of zsmalloc as the default allocator for zswap is its lack of writeback capability. However, this has changed, with the zsmalloc writeback patchset, and the subsequent zswap LRU refactor. With this, there is not a lot of good reasons to keep zbud, an otherwise inferior allocator, as the default instead of zswap. This patch changes the default allocator to zsmalloc. The only exception is on settings without MMU, in which case zbud will remain as the default. Signed-off-by: Nhat Pham Acked-by: Johannes Weiner Acked-by: Yosry Ahmed --- mm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/Kconfig b/mm/Kconfig index 721dc88423c7..e0217deca084 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -130,6 +130,7 @@ config ZSWAP_COMPRESSOR_DEFAULT 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