From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E9542C15B5 for ; Mon, 24 Nov 2025 17:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=96.67.55.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764006223; cv=none; b=lEolu4ZNdJV3Md8GzYXbPc5ne1scpBcL3Yp+5oDKV5rnIw9B+aquURuovPbCeGd6pG+k4tn+RmBsPuL+sEVd6nKAr1WNYExWFyDumx8uGe61ZbuWFRn3t9Z8/K7/0s/8WjQdPqQ/f4oj6AZDiVm/aE9Kzl51HEk7xZtktmz9fKU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764006223; c=relaxed/simple; bh=Z/I9K/FvlzwwzFcfXNsTEhQVXUvQTpjTeN/OkRnIVAw=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=mNg4aPwzhcIXcUM3WMzE1QHY+eajT4FjerAptu3aFqw4EoPDT5V+EN29qsZUggH+XnYyULh/TdDDTvOobHs1mAyplNm5maqpA2/rXSgYv2Io5uj47mgkkvpQ6tZycYvTqtmE8GlAEYWOanauo7Pohg9tQz5/7zWKycAXDNBzb4o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com; spf=pass smtp.mailfrom=surriel.com; dkim=pass (2048-bit key) header.d=surriel.com header.i=@surriel.com header.b=PYZq+3N6; arc=none smtp.client-ip=96.67.55.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=surriel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=surriel.com header.i=@surriel.com header.b="PYZq+3N6" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=surriel.com ; s=mail; h=MIME-Version:Content-Transfer-Encoding:Content-Type:References: In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Z/I9K/FvlzwwzFcfXNsTEhQVXUvQTpjTeN/OkRnIVAw=; b=PYZq+3N6tjX6NJWqEaPcfN5Cla j/JkOMprSa5JJaRiwiz8QoEfuB0KROt1C7m8FS/MP+tTkk9Ku2QPVCnPhIcWCAA2fJk85EbV7wFtL t4uXLDQTLYRtKoZa4cx5DOidMqSWu7ad4ohBB3eIyqVH0pHFJ5qnPnAV4rIt79QaevKsuWYilL5nd W6XT5sVzpdM+NcJgvhKgw+1ZbHTubi8DBBmBQO6vleE/GoaY8d2OOT/4E6vLPE+CoIF/LB1CuGIxF zxwPxoEFA3E9eX66HEgP8Rvv4MADC+XXy3e0D0JDzcaj+7IICesW5SZrpS1P2ElBvbszcgw6Dm/jl ZWrMJXwQ==; Received: from fangorn.home.surriel.com ([10.0.13.7]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1vNaaH-000000003Bs-2utf; Mon, 24 Nov 2025 12:42:42 -0500 Message-ID: <86fa3bc129bbd0e0da9d118ca6441e34a389fd2b.camel@surriel.com> Subject: Re: [PATCH RFC] mm: ghost swapfile support for zswap From: Rik van Riel To: Chris Li Cc: Johannes Weiner , Andrew Morton , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Yosry Ahmed , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org, pratmal@google.com, sweettea@google.com, gthelen@google.com, weixugc@google.com Date: Mon, 24 Nov 2025 12:42:42 -0500 In-Reply-To: References: <20251121-ghost-v1-1-cfc0efcf3855@kernel.org> <20251121114011.GA71307@cmpxchg.org> <340fd55d9d7d9436f18205bb458e9bd469b36c6c.camel@surriel.com> Autocrypt: addr=riel@surriel.com; prefer-encrypt=mutual; keydata=mQENBFIt3aUBCADCK0LicyCYyMa0E1lodCDUBf6G+6C5UXKG1jEYwQu49cc/gUBTTk33A eo2hjn4JinVaPF3zfZprnKMEGGv4dHvEOCPWiNhlz5RtqH3SKJllq2dpeMS9RqbMvDA36rlJIIo47 Z/nl6IA8MDhSqyqdnTY8z7LnQHqq16jAqwo7Ll9qALXz4yG1ZdSCmo80VPetBZZPw7WMjo+1hByv/ lvdFnLfiQ52tayuuC1r9x2qZ/SYWd2M4p/f5CLmvG9UcnkbYFsKWz8bwOBWKg1PQcaYHLx06sHGdY dIDaeVvkIfMFwAprSo5EFU+aes2VB2ZjugOTbkkW2aPSWTRsBhPHhV6dABEBAAG0HlJpayB2YW4gU mllbCA8cmllbEByZWRoYXQuY29tPokBHwQwAQIACQUCW5LcVgIdIAAKCRDOed6ShMTeg05SB/986o gEgdq4byrtaBQKFg5LWfd8e+h+QzLOg/T8mSS3dJzFXe5JBOfvYg7Bj47xXi9I5sM+I9Lu9+1XVb/ r2rGJrU1DwA09TnmyFtK76bgMF0sBEh1ECILYNQTEIemzNFwOWLZZlEhZFRJsZyX+mtEp/WQIygHV WjwuP69VJw+fPQvLOGn4j8W9QXuvhha7u1QJ7mYx4dLGHrZlHdwDsqpvWsW+3rsIqs1BBe5/Itz9o 6y9gLNtQzwmSDioV8KhF85VmYInslhv5tUtMEppfdTLyX4SUKh8ftNIVmH9mXyRCZclSoa6IMd635 Jq1Pj2/Lp64tOzSvN5Y9zaiCc5FucXtB9SaWsgdmFuIFJpZWwgPHJpZWxAc3VycmllbC5jb20+iQE +BBMBAgAoBQJSLd2lAhsjBQkSzAMABgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRDOed6ShMTe g4PpB/0ZivKYFt0LaB22ssWUrBoeNWCP1NY/lkq2QbPhR3agLB7ZXI97PF2z/5QD9Fuy/FD/jddPx KRTvFCtHcEzTOcFjBmf52uqgt3U40H9GM++0IM0yHusd9EzlaWsbp09vsAV2DwdqS69x9RPbvE/Ne fO5subhocH76okcF/aQiQ+oj2j6LJZGBJBVigOHg+4zyzdDgKM+jp0bvDI51KQ4XfxV593OhvkS3z 3FPx0CE7l62WhWrieHyBblqvkTYgJ6dq4bsYpqxxGJOkQ47WpEUx6onH+rImWmPJbSYGhwBzTo0Mm G1Nb1qGPG+mTrSmJjDRxrwf1zjmYqQreWVSFEt26tBpSaWsgdmFuIFJpZWwgPHJpZWxAZmIuY29tP okBPgQTAQIAKAUCW5LbiAIbIwUJEswDAAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQznneko TE3oOUEQgAsrGxjTC1bGtZyuvyQPcXclap11Ogib6rQywGYu6/Mnkbd6hbyY3wpdyQii/cas2S44N cQj8HkGv91JLVE24/Wt0gITPCH3rLVJJDGQxprHTVDs1t1RAbsbp0XTksZPCNWDGYIBo2aHDwErhI omYQ0Xluo1WBtH/UmHgirHvclsou1Ks9jyTxiPyUKRfae7GNOFiX99+ZlB27P3t8CjtSO831Ij0Ip QrfooZ21YVlUKw0Wy6Ll8EyefyrEYSh8KTm8dQj4O7xxvdg865TLeLpho5PwDRF+/mR3qi8CdGbkE c4pYZQO8UDXUN4S+pe0aTeTqlYw8rRHWF9TnvtpcNzZw== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-2.fc41) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Mon, 2025-11-24 at 20:26 +0300, Chris Li wrote: > On Mon, Nov 24, 2025 at 7:15=E2=80=AFPM Rik van Riel > wrote: > >=20 > > On Fri, 2025-11-21 at 17:52 -0800, Chris Li wrote: > > > On Fri, Nov 21, 2025 at 3:40=E2=80=AFAM Johannes Weiner > > > > > > wrote: > > > >=20 > > > >=20 > > > > Zswap is primarily a compressed cache for real swap on > > > > secondary > > > > storage. It's indeed quite important that entries currently in > > > > zswap > > > > don't occupy disk slots; but for a solution to this to be > > > > acceptable, > > > > it has to work with the primary usecase and support disk > > > > writeback. > > >=20 > > > Well, my plan is to support the writeback via swap.tiers. > > >=20 > > How would you do writeback from a zswap entry in > > a ghost swapfile, to a real disk swap backend? >=20 > Basically, each swap file has its own version swap > ops->{read,write}_folio(). The mem swap tier is similar to the > current > zswap but it is memory only, there is no file backing and don't share > swap entries with the real swapfile. >=20 > When writing back from one swap entry to another swapfile, for the > simple case of uncompressing the data, data will store to swap cache > and write to another swapfile with allocated another swap entry. The > front end of the swap cache will have the option map the front end > swap entry offset to the back end block locations. At the memory > price > of 4 byte per swap entry. Wait, so you use the swap cache radix tree to indicate the physical location of data between multiple swap devices? Isn't that exactly what the vswap approach does, too? How is this different? --=20 All Rights Reversed.