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 D75B7C6FD1D for ; Fri, 17 Mar 2023 18:20:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EDF596B0075; Fri, 17 Mar 2023 14:20:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E68826B0078; Fri, 17 Mar 2023 14:20:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D091B6B007B; Fri, 17 Mar 2023 14:20:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C264F6B0075 for ; Fri, 17 Mar 2023 14:20:02 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 831CF12082D for ; Fri, 17 Mar 2023 18:20:02 +0000 (UTC) X-FDA: 80579204244.07.671F729 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf05.hostedemail.com (Postfix) with ESMTP id 9E9B5100014 for ; Fri, 17 Mar 2023 18:20:00 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ijHOa0Cu; spf=pass (imf05.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=1679077200; 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=eX5U3SYRuopVd7m8LdJHptS3R8cBT27sYI5TK3VnmPE=; b=2Rw25LBFs6/2z9sS3GM3/lDRYPW8s2ErFvJrYS8hzOMXfBLg2T3llzQA8hGLTmmlCLCRUq p5CF5Z/mH4FrwmIBlwh7tuF0MGsnzx7BicVeZIbePCPsX+u7n+Qn41DEssZP4mPIfQ/5Vg G8yQuIywhzuyHagO1W+8jeDiY4J9H+c= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ijHOa0Cu; spf=pass (imf05.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=1679077200; a=rsa-sha256; cv=none; b=IXzx5QEAZyelcq1eHAkORvY/Eb/RQHXgXTvdIP+qaPJQf0+HWLbZyfEhMGaQcUen2wXzdH 4VYsuSiIfrmkwaHCdb5dRbop6VsD1IsmUL7fLDKoTNtHEBOxHzSPrZmvfiJktZJEh500Eq A/CWhF5xmwkt3IACaBEuPnXHm1/JrFA= 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 BF602B82692; Fri, 17 Mar 2023 18:19:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB529C433EF; Fri, 17 Mar 2023 18:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679077197; bh=svoQRekuqQ8dt1YUBLkFjhWaM+V1t2cc4ebCuACrhWg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ijHOa0CuZihvy2KHbe7YXOJSgjgdLn8LHd7NPP3iBpHfh/x9J2G07KbRN7FfBlz6I +LSmSIOMQQ2SFGRZgzOySJALYMBXtxmqHIBcv0AtB/fF3ySxI+S8oEsoS8hB2OUKXn THi3KxjuhO30tWr1hqTENGz6HO5oPQtyvYYssrFqEa25lE/Jp7rfYXtCpr8havvvsY wcD6MNwYPJJRrIg2kFK/U9oMRruUn+3l9CF0erqLKSTdZy2TXEdIVTgkriXCmfsyr6 lIQEWTSXu7dUdK6uZ67R0MtHQyMijZ0CQeJh8TTITmahh+6ziTqvsOJb9D/DRFuazo EaobMmWz61sBA== Date: Fri, 17 Mar 2023 11:19:55 -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: <87356e850j.fsf@yhuang6-desk2.ccr.corp.intel.com> <87y1o571aa.fsf@yhuang6-desk2.ccr.corp.intel.com> <87o7ox762m.fsf@yhuang6-desk2.ccr.corp.intel.com> <87bkkt5e4o.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-Rspamd-Queue-Id: 9E9B5100014 X-Stat-Signature: 6cy53kq68ts39doixzsnpsii1heiniaq X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1679077200-523261 X-HE-Meta: U2FsdGVkX1/bRSZz2GZVAi1iB7M9uOQ6xIDAvBOS8PTr94oectwDa5ujj7J5G9SgGgCoBZoP7UJdF701qmsoR099tDtBOrGtuFPIfSqCEtgWz6oakjbY4QCoViTBbA/KyID0drqjTLuPgZ4hzY9wYfN5IfrECo3bBhSKZ/gnDMpmVWICTmTDmvL4nNJdpKBXykT5CNnXu2Lv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z7FkFpV4PQ== 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 Fri, Mar 17, 2023 at 03:19:09AM -0700, Yosry Ahmed wrote: > > Now, we will not drop the swap cache even if the swap count becomes 0 if > > swap space utility < 50%. Per my understanding, this avoid swap page > > writing for read accesses. So I don't think we can change this directly > > without necessary discussion firstly. > > > Right. I am not sure I understand why we do this today, is it to save > the overhead of allocating a new swap entry if the page is swapped out > again soon? I am not sure I understand this statement "this avoid swap > page > writing for read accesses". When the page is swapped out again soon. If the swap slot has been recycled, then the page need to assign to a new swap slot, most likely different than the previous slot. Then the page write out would need to write that page to the swap device, even though that swap device might already has the same page data in the previous slot. If keeping the previous swap slot cache when swap space utility < 50%, then the swap code can avoid writing out to the same slot with the same data, if the page is not dirty (read only access). The saving is in 1) avoid allocating a new slot. 2) For read access, avoid page io write the same data to the same slot. Chris