From mboxrd@z Thu Jan 1 00:00:00 1970 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 3A7CFC77B60 for ; Tue, 28 Mar 2023 21:32:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C05136B0078; Tue, 28 Mar 2023 17:32:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BDB966B007D; Tue, 28 Mar 2023 17:32:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA30B6B007E; Tue, 28 Mar 2023 17:32:13 -0400 (EDT) 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 9BCA26B0078 for ; Tue, 28 Mar 2023 17:32:13 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 642E8140B54 for ; Tue, 28 Mar 2023 21:32:13 +0000 (UTC) X-FDA: 80619605346.27.65B6D04 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf14.hostedemail.com (Postfix) with ESMTP id 86627100011 for ; Tue, 28 Mar 2023 21:32:11 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GuUWYRG1; spf=pass (imf14.hostedemail.com: domain of chrisl@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=chrisl@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680039131; a=rsa-sha256; cv=none; b=AOi/uU5oVQdoaf7O5KNwVOGIRHaP5g/bwriPVWyabPfiX8z/nJI4V6oRxm1eFxc+08K2C2 sHHy66YhSxlgtH7QW1dN3I1i6AuVnox2NB6XtHKp4DWy8BtmvyGdbUGxPZs8cVsqMWB9qX b+vuhSA7POalWmhuqVUpfWfr3WhnCMI= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GuUWYRG1; spf=pass (imf14.hostedemail.com: domain of chrisl@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=chrisl@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680039131; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wKSwMMkwk0piKRm5IGeZWybQRrTvzOF2DPTdwRcYRqQ=; b=Dm518QDAkKwg/E/kipXDRHF8cBk+ksGOnDsGbRoyDXomXJbRYcQMfPlAQxIYpwOnz/ZXl6 LCVpMwkb73xS9xLq9toAayaqK0OhMIeWx92bnIN2VizurKM4bUDLKhMzssSE8wBYkLk3YX szdHgoVbE8gNE/+sjobZJI14Ya8Lims= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26392B81EAB; Tue, 28 Mar 2023 21:32:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21A05C433EF; Tue, 28 Mar 2023 21:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680039128; bh=pzBka9D3rHnBm0S7Z1iF58yd2A9g9mMzqqhlPHc9DvI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GuUWYRG1EI9ZOwvgT6yNOYVo/KgSVnH4VaTB1xUU+LjKkGJPF20k1Ixv/DvW3Okp6 VU0hlnldlekJijiHOcZCgeNrIVnjZ1eqcvZAlZOHplFy/FTDyngsfZ2ryw8gtzF4OV AXGpxJ4vf9U17qm/k7qwOHG8/3vmlVtI+TqyzwvNJTkBRlElD4er5StHje4tYWttVK oekD4QtRKHj4DLedkfHmx+Ujpd9g6QBLGeqvRc1kbWiNCXw8FTGXUdl/P82NmtD93J TDf8z0imTGiRDgfNqeY7EpgnOeZ5koJDVTiqV7E+k015JS9WEzTy/dquxO5WXGwHYa 7zm2HkVUPOYmA== Date: Tue, 28 Mar 2023 14:32:06 -0700 From: Chris Li To: Yosry Ahmed Cc: "Huang, Ying" , lsf-pc@lists.linux-foundation.org, Johannes Weiner , Linux-MM , Michal Hocko , Shakeel Butt , David Rientjes , Hugh Dickins , Seth Jennings , Dan Streetman , Vitaly Wool , Yang Shi , Peter Xu , Minchan Kim , Andrew Morton , Aneesh Kumar K V , Michal Hocko , Wei Xu Subject: Re: [LSF/MM/BPF TOPIC] Swap Abstraction / Native Zswap Message-ID: References: <87edpbq96g.fsf@yhuang6-desk2.ccr.corp.intel.com> <87jzz1pfb3.fsf@yhuang6-desk2.ccr.corp.intel.com> <87fs9ppdhz.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspam-User: X-Rspamd-Queue-Id: 86627100011 X-Rspamd-Server: rspam01 X-Stat-Signature: ew8ei8bd6qzped3qet3jxgmrgwt5cudq X-HE-Tag: 1680039131-286142 X-HE-Meta: U2FsdGVkX1+nvk+zLGwrVd37OcA2Mut3ZRlrevcfLJLEGI1pc9c7WA/bOJllM0KK5SmbFm9hIwG0jBdwvS+UhZBDvCv7HPagUtowja4rrnDuoH8aXO1n0GLWFAqe88i9nJEv8HjLebYnh5ju9jnBpHu2cZ58my8PIYldFSSz7bq1JfY2Lh6b33a2yPSR25SgV5cNKWDT9Aui5T4Rd9Sx7tQksS7I5SnJraS/3QvMJoMw9eHBQ0cISYIpuSAo7iGKCKdaXCJSw8KEWsCKhNhvAZc+0Ovu2N/qcmY4qSV9qX2yGci5+LyRQ4iepmPcbzfLW2GcnhGZujVUEMK+YUw/18/MnsPda13+S2Zkuq9W+7kr/fi5I//5QPeXgTqJZs3XBaiJr4y1GZMOsirGP9dJ522zWk5vAsjvyamh3KjYkeDS2zBUujbCppZruZO3q8zEUcNwRVeLfkp7p/hlPT2VXN6BY5MukrrdQqaAWYIOkhOxuSukI7yvNn8j2P6TLj6EvyyAaTQ3tdyhS/iRCiqncXTRJW/nknqM/g7lMuFt5OutThzU7En4+dUffk2SN+YHCzcdkmGSms3Qpin6v5IzQlkK8X9fliafFgjLW4T6YR6NkD5DwX/Bzs1FpNWP/mIL75pdD2N1SRWoIwAA9bSSIY4/OxBdkrQXTLCQuaoELZ9wwqeo9VbGlQBqm2ipsspwKqagJKUVLPxxlxPgD46DjVv0Em3LwmdAhnyuniy3M4bsN7NJE0CPj0DzQB7PpCz6x1DjpZC1XsL/0FXVxUWtHPP46DA28sIk/psJ9mcW5nGGm7dmPZA5UxWRYQ0oQlWvpKuCaJ39/cMCF7uv+BK1AK0EfreGzQXtrHLb1b2ULIOATRmbgII7Ci9vw+dwtOdI0hvmNoMa+1Q7xiRvpSOr/JQWSRc00z9rbwi07NtoQQ5qinO2ZDifzgHwDHoezciWOPyrIZrfWZSfsbab2kW VPUYp2se +TmTbHJwDAup/wwWdH/E7GWBIjuJ3rkcP7zH5xEIDD/AfgRj0EaIpgiT6kw29aeNfjxIAP6DUPLphjwufHXxSaGRdF1FgKyeGT57c1IsoHvMMQofFzTpjx5WG/8fslgjyqCuNEX5gjWthR1I1W0K8v4gm1AkgasgnATBVSlHagnEUXT4qyynYvHMSWZxEELo5OgB+ 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: On Tue, Mar 28, 2023 at 02:01:09PM -0700, Yosry Ahmed wrote: > On Tue, Mar 28, 2023 at 1:50 PM Chris Li wrote: > > > > On Tue, Mar 28, 2023 at 12:59:31AM -0700, Yosry Ahmed wrote: > > > > > I don't have a problem with this approach, it is not really clean as > > > > > we still treat zswap as a swapfile and have to deal with a lot of > > > > > unnecessary code like swap slots handling and whatnot. > > > > > > > > These are existing code? > > > > Yes. The ghost swap file are existing code used in Google for many years. > > > > > I was referring to the fact that today with zswap being tied to > > > swapfiles we do some necessary work such as searching for swap slots > > > during swapout. The initial swap_desc approach aimed to avoid that. > > > With this minimal ghost swapfile approach we retain this unfavorable > > > behavior. > > > > Can you explain how you can avoid the free swap entry search > > in the swap descriptor world? > > For zswap, in the swap descriptor world, you just need to allocate a > struct zswap_entry and have the swap descriptor point to it. No need > for swap slot management since we are not tied to a swapfile and pages > in zswap do not have a specific position. Your swap descriptor will be using one swp_entry_t, which get from the PTE to lookup, right? That is the swap entry I am talking about. You just substitute zswap swap entry with the swap descriptor swap entry. You still need to allocate from the free swap entry space at least once. Chris