Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp158313rdb; Wed, 21 Feb 2024 22:24:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU1ejhXCL9LDy/a5LK6sIXBhM/LXPc5tywGrx3BA2Ak8Fm43HbcK0mTwPfk25nRWb5GIInjbF5wJr3Wh4YkUWNjxSVrjSMyp199lCFlBQ== X-Google-Smtp-Source: AGHT+IE97NU5MGbymVQasWBseDyNslVU8RqAaiDTB9G/NR+um9LNInRHxIGHVIPVORmeFYGRhYW7 X-Received: by 2002:a81:b664:0:b0:608:801a:e661 with SMTP id h36-20020a81b664000000b00608801ae661mr3198576ywk.51.1708583054012; Wed, 21 Feb 2024 22:24:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708583053; cv=pass; d=google.com; s=arc-20160816; b=aRPFZUklO2bykRixJE8M8t4MypFIYJc5pv1lH2WdtmoHIi+98VgekCs4rBbteMUggd 8F5C+coWMm0xieBFWJy1FpNR5ie+lzrkg0s/b8X5uXqJVEzRZlY/Da0YcW1yJH3GvaFy AjxayZoY9fwBA0GtCtpoB23AmCRct/hUOa6zYvw4R2dO+grwvbX2MCameKK5HmcEPwO9 s8mrKzupdU5Z5v3n+FuaiYW4xoeCH20ONKF0bQ7nCPlmAimCBk+gQVF6JvASnSSDO4pJ MREePtuQxxPJWT4IKFYSqp9xZ95OgGROhFlbz52O2ZW2YuBVQSVn66M3Za2ck/Zz6dAW SRJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=ri4f+uV+Toa3UuYT6CTdh8+5f7xMDn6MuuNtTjFrq2c=; fh=0Cap5UlbaHls0FV6klwPKQwg4bulZoxGR/rj5zQzKyo=; b=XZneul5xfgBWA7SzDW2nB1FmUNe7yJMLaoldCAdhwguHtVf9Gbw/QmkFL6I1NO55tC i2Lj4O+WFgcO+ynYw8fQwqmh+/ixZ7TZz5uirbiLxb08H7Hp73MlA6HpHiv3eYaUlxtv TBP1f3Yr4C/gfozq3RFn0OkyroBb7BX1g7eMwJauj3ghs5V/o02uW4GRnMQq0/cCMAit prHsK3Z3xTSwE8vHLvsYfchQJ1jcqr4J0eufGYboGJLOTny6Y8yeq0ZHztQBOHGYim7m uQVD/a3GIBq6NJDBWqSyEBAoT/h5q4G2+OFtVFiUAERVAWYLZwtcw9NT8/fO0XzRZlIV qw9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MOtKgL2q; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75980-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75980-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y8-20020ac85f48000000b0042d24a32838si13694962qta.54.2024.02.21.22.24.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 22:24:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75980-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MOtKgL2q; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75980-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75980-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7FA1C1C21979 for ; Thu, 22 Feb 2024 06:24:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACC0317BBA; Thu, 22 Feb 2024 06:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MOtKgL2q" Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D017C18046 for ; Thu, 22 Feb 2024 06:23:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708583045; cv=none; b=fiR7IfR2RXzTvhbQyCwNdgasa03gc5fIFlsHhZnJWarvJZHay6ldqjEmBjmEqE4FsQ2yVkMEi3WrNGSGVn5t9CHSqWqmT8a+aDfGSk1gL/w+Uz7ooiD/tXQAk4bEIFhxofTu9XbRo7yL1NPHfU1drSOkYooRpVFQc9rMZfvIq9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708583045; c=relaxed/simple; bh=ri4f+uV+Toa3UuYT6CTdh8+5f7xMDn6MuuNtTjFrq2c=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TKuxIRFde0AQFRjYWhzE+Q7uzc9HdhhqFL6hsRSbI9t5GjpYsfnxKRexNNApp0/N87mfj5IFqxhRQtf/DJM2/y2nSfwvCbh4xaSwIVnU3oHaKE2Tr5nyS0Xe1Q5qs3LaQeYYLORFjRNR52Mx2C2DyUeh+AgeagvlpgHp43iJyUY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MOtKgL2q; arc=none smtp.client-ip=209.85.166.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-7c76e0c2086so87739839f.0 for ; Wed, 21 Feb 2024 22:23:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708583035; x=1709187835; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ri4f+uV+Toa3UuYT6CTdh8+5f7xMDn6MuuNtTjFrq2c=; b=MOtKgL2qRuXwuJl5MSUIe3NjZyxsrKcy5BquYhGyxyiq33Xf5h5nfoUmSiPJHzaP4D 2Eobdbt5V9+Uhgod4osjNjRyXpTO8IQZ0glZC8GT7RuyserPqggReI9EPKH8HZrblJys 2u+PnhQPtjlvzte3G/2kH6Fxd0kl8nuH9XVC1drvHAUQOYXF956EyTScX4zRjpfeYd+k nGxZDRyj6WsZxG6jQ/riE5WrQcAzzT7bjRPBYeWhx6lPvdRHZ5AJ2eCqeCplkmeARRld UjmV/OsNxzXzijHiqopGc32cXClHKkgaJFAXoqVyVQVPPGVx63dG/7Tm7KexKGCv+Y37 rnrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708583035; x=1709187835; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ri4f+uV+Toa3UuYT6CTdh8+5f7xMDn6MuuNtTjFrq2c=; b=uyQ2k57ofPV14YKeHgc0Hdah3a3LQtjn02p7W4+t6aMu7+F4VEckzduDwdypzqANHh BHcC+7Zg2LtpS+Na/b8e4gyl1rd0W7gOhpETpw19TjQyWQybtdglt4E2k+Uij4D+lmmF 4QeWt61COEnA7xjgsbZUOQ7DH2oNMZvGcMpTOCJHszo5dAh2o8Ty6CTW0gQJd2UfqYxl gbnKSs/ZbXUpShwvPGsPgatrbwvivb6jvi8+O0+ybxXTz8zm5xN0k31+ijebJfGLC/Ln NCJ4qHqtgsnmX3nWZzuUw9WnumIdt8/NDVlMPLQLXSjjLvCXWS+UYxfhRPrAEjc2IZhx 1ysQ== X-Forwarded-Encrypted: i=1; AJvYcCX8QphhV4RefL4YthgBRd5R79jPMG2q+8pary1lTwBszWsVo71L2/ijbrxWFeJWJ7iHVIUK944/2BgxJ4y+46pT2ync3iRQHbTkz9xg X-Gm-Message-State: AOJu0Yx3gBJj1VrA1iLjnNFt5PcC7/DRKIQlpCJSSn66gkODJHDhPEcj +TAMlkjNDiYR/ewqmCvffrmVKwR7/rrDANbNUEtbH96JNx3guQ7kIxIvLvBzERTD/C2M6HIf3hY 6LyqrbxHfSbDX2xocdkBPSGnFBrs= X-Received: by 2002:a05:6602:e46:b0:7c7:43f5:26a0 with SMTP id gq6-20020a0566020e4600b007c743f526a0mr13018369iob.1.1708583034853; Wed, 21 Feb 2024 22:23:54 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Nhat Pham Date: Thu, 22 Feb 2024 13:23:43 +0700 Message-ID: Subject: Re: [RFC] Analyzing zpool allocators / Removing zbud and z3fold To: Yosry Ahmed Cc: Andrew Morton , Vitaly Wool , Miaohe Lin , Johannes Weiner , Linux-MM , Linux Kernel Mailing List , Christoph Hellwig , Sergey Senozhatsky , Minchan Kim , Chris Down , Seth Jennings , Dan Streetman , Chris Li Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Feb 9, 2024 at 10:27=E2=80=AFAM Yosry Ahmed = wrote: > > I did not perform any sophisticated analysis on these histograms, but > eyeballing them makes it clear that all allocators have somewhat > similar latencies. zbud is slightly better than zsmalloc, and z3fold > is slightly worse than zsmalloc. This corresponds naturally to the > build times in (a). > > (c) Maximum size of the zswap pool > > *** zsmalloc *** > 1,137,659,904 bytes =3D ~1.13G > > *** zbud *** > 1,535,741,952 bytes =3D ~1.5G > > *** z3fold *** > 1,151,303,680 bytes =3D ~1.15G > > zbud consumes ~32.7% more memory, and z3fold consumes ~1.8% more > memory. This makes sense because zbud only stores a maximum of two > compressed pages on each order-0 page, regardless of the compression > ratio, so it is bound to consume more memory. > > -------------------------------- -----------------------------= --- > > According to those results, it seems like zsmalloc is superior to > z3fold in both efficiency and latency. Zbud has a small latency > advantage, but that comes with a huge cost in terms of memory > consumption. Moreover, most known users of zswap are currently using > zsmalloc. Perhaps some folks are using zbud because it was the default > allocator up until recently. The only known disadvantage of zsmalloc > is the dependency on MMU. > > Based on that, I think it doesn't make sense to keep all 3 allocators > going forward. I believe we should start with removing either zbud or > z3fold, leaving only one allocator supporting MMU. Once zsmalloc > supports !MMU (if possible), we can keep zsmalloc as the only > allocator. > > Thoughts and feedback are highly appreciated. I tried to CC all the > interested folks, but others feel free to chime in. I already voiced my opinion on the other thread, but to reiterate, my vote is towards deprecating/removing z3fold :) Unless someone can present a convincing argument/use case/workload, where z3fold outshines both zbud and zsmalloc, or at least is another point on the Pareto front of (latency x memory saving).