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 6AD1BC6FD20 for ; Fri, 24 Mar 2023 17:28:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E55F46B0072; Fri, 24 Mar 2023 13:28:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E06656B0074; Fri, 24 Mar 2023 13:28:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCEA36B0075; Fri, 24 Mar 2023 13:28:58 -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 BABE06B0072 for ; Fri, 24 Mar 2023 13:28:58 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8E148AB654 for ; Fri, 24 Mar 2023 17:28:58 +0000 (UTC) X-FDA: 80604477156.29.55073F2 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf11.hostedemail.com (Postfix) with ESMTP id 29DD44001A for ; Fri, 24 Mar 2023 17:28:55 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GBK10cuV; spf=pass (imf11.hostedemail.com: domain of chrisl@kernel.org designates 145.40.73.55 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=1679678936; a=rsa-sha256; cv=none; b=Q1qpkAKMO72dgJxZXF8C6LZIBYJCNoQFq2KAcij90cQqNrKuxhQwwIlI1RBTLslNyPAfbg AhYyCbw5D7/lXkXWQUo0ldya6VYBoAK0NToGiwjjTJR+rWovW2eXMqjr9mbA5TArakqRto VNhKOomAa+/oaBhZKzgL8L1vSU4cD5M= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GBK10cuV; spf=pass (imf11.hostedemail.com: domain of chrisl@kernel.org designates 145.40.73.55 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=1679678936; 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:in-reply-to:references:references:dkim-signature; bh=MNGClMng7iqrvOyPBNN0izE08hNCkhY22MRFKPr9v0E=; b=W9BC0K22kwgzH0JyrjMqhK6gVW0dd+Gd/49ExWzkVi/RwvR40eVXh14G017Vu7Hdi9Gtb1 m9GCVeOrbl0zBSlKdCoFTXZ1OkRn84/xrIoD91I9JmUPI6G+Fw3opD1V0clFlbSos8uhA+ HpKeF5ltfes/DNw73pVuO0RjBtjdlls= 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 sin.source.kernel.org (Postfix) with ESMTPS id D4AADCE270D; Fri, 24 Mar 2023 17:28:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 727EEC4339B; Fri, 24 Mar 2023 17:28:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679678929; bh=4M1KZFN+fFtrfNV92jrCZqsGKXKGyR3uWu5plUhm2kE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GBK10cuVWe0OyFF8ixCvWXX6Hhwf6x9v1/04QxFW4xf4mCj//KdW2pME7VxfSZzZz sjOdt/5cDwI0oxc5ZWmPKjf2JktMjqSx0H9mCTcOVNa7xk+6doYUGovKJ8jlq944wu kruX3THUhal37SsNrET7SCxdoPPsYb41w+Rv9Gikr9CTrG0i7qRLdMFUmp6JJNdw7z Rd8ZBmfQjUYQJ2//zOXEPHP0mWGkLsW97++7gPaHNAuhkBIvc/ASfUevSG/rdjZUd5 VtkbwZj/iLVWl7E1juLGvXabhuWdj40eMVOPCeln1f/SucBjfHhBDwFVt9pSRditbH nVgvmu4+s+bnw== Date: Fri, 24 Mar 2023 10:28:46 -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: <87y1ns3zeg.fsf@yhuang6-desk2.ccr.corp.intel.com> <878rfothdg.fsf@yhuang6-desk2.ccr.corp.intel.com> <871qlgrm5j.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Queue-Id: 29DD44001A X-Rspamd-Server: rspam01 X-Stat-Signature: mpoi9u3515hauznxt7r9ktq7xojj173t X-HE-Tag: 1679678935-292907 X-HE-Meta: U2FsdGVkX1/NNnoS3YojAQUqDSTmOwmBf9QanczL7xS1pkK+TSM6fQQ78sDEX0zTpEjmKFAei7OwKbgana+O4SpvdWTVsJ7KkXDzFkJypuEx62tqv7pXuv1yq5fH5LqM+sGbx8cOG9raiokztZWRVKKAbVj/CZlKNabw85rffgs2AUwnRub2W/HIe4LQBHPITJZW/Fsqh+rP8Gy6JK5M4oaDWNfa9xprDLKHBR2Ko3fBh5sVKHETp1aZZlTe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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 Thu, Mar 23, 2023 at 12:54:42PM -0700, Yosry Ahmed wrote: > > > > At the time of swap out page into A, we will not know if it will > > move to B in a later time. I guess the swap ID xarray look up always > > needs to be there? > > If the indirection is enabled, yes. > > > > > > Moving a page from a swap backend A to another swap backend B should > > > not be a problem in terms of the swap cache, as we will add it to the > > > swap cache of B, modify the swap ID mapping to point to B, then remove > > > it from the swap cache of A. > > > > That means when B swap in a page, it will always look up the swap ID > > xarray first, then resolve to the actual swap_entry B1. > > Yes. There is an extra lookup. Ack. > > > > > > There are some concerns with this design that I outlined in one of my > > > previous emails, such as having separate swap counting implementation > > > in different swap backends, which is a maintenance burden and > > > error-prone. > > > > I agree that allocating the swap ID and maintaining the free swap ID > > would be some extra complexity if we are not reusing the existing swap > > count code path. > > > > My other concern would be the swap ID xarray indirection is always there > > regardless if you need to use the indirection or not. > > I think the idea is that this design is more minimal than the proposed > swap_desc, so we can have it behind a config option and remove the > indirection layer if it is not configured. > However, I am not yet sure if this would be straightforward. I need to > give this more thought. I have given it some thought. I am still concerned about this always on redirect layer in terms of memory usage and lookup overhead. Chris