linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: David Hildenbrand <david@redhat.com>
Cc: Barry Song <21cnbao@gmail.com>,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Barry Song <v-songbaohua@oppo.com>,
	Usama Arif <usamaarif642@gmail.com>,
	Chengming Zhou <chengming.zhou@linux.dev>,
	Yosry Ahmed <yosryahmed@google.com>,
	Nhat Pham <nphamcs@gmail.com>, Hugh Dickins <hughd@google.com>,
	Matthew Wilcox <willy@infradead.org>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Andi Kleen <ak@linux.intel.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Chris Li <chrisl@kernel.org>,
	"Huang, Ying" <ying.huang@intel.com>,
	Kairui Song <kasong@tencent.com>,
	Ryan Roberts <ryan.roberts@arm.com>
Subject: Re: [PATCH v2] mm: count zeromap read and set for swapout and swapin
Date: Mon, 4 Nov 2024 11:34:02 -0500	[thread overview]
Message-ID: <20241104163402.GA810664@cmpxchg.org> (raw)
In-Reply-To: <c7a90ccf-c1b1-480c-9f2a-88ef37c3d89e@redhat.com>

On Mon, Nov 04, 2024 at 01:42:08PM +0100, David Hildenbrand wrote:
> On 02.11.24 11:12, Barry Song wrote:
> > @@ -1599,6 +1599,16 @@ The following nested keys are defined.
> >   	  pglazyfreed (npn)
> >   		Amount of reclaimed lazyfree pages
> >   
> > +	  swpin_zero
> > +		Number of pages moved into memory with zero content, meaning no
> > +		copy exists in the backend swapfile, allowing swap-in to avoid
> > +		I/O read overhead.
> > +
> > +	  swpout_zero
> > +		Number of pages moved out of memory with zero content, meaning no
> > +		copy is needed in the backend swapfile, allowing swap-out to avoid
> > +		I/O write overhead.
> 
> Hm, can make it a bit clearer that this is a pure optimization and refer 
> to the other counters?
> 
> swpin_zero
> 	Portion of "pswpin" pages for which I/O was optimized out
> 	because the page content was detected to be zero during swapout.

AFAICS the zeropages currently don't show up in pswpin/pswpout, so
these are independent counters, not subsets.

I'm leaning towards Barry's side on the fixes tag. When zswap handled
the same-filled pages, we would count them in zswpin/out. From a user
POV, especially one using zswap, the behavior didn't change, but the
counts giving insight into this (potentially significant) VM activity
disappeared. This is arguably a regression.

> swpout_zero
> 	Portion of "pswout" pages for which I/O was optimized out
> 	because the page content was detected to be zero.

Are we sure we want to commit to the "zero" in the name here? Until
very recently, zswap optimized all same-filled pages. It's possible
somebody might want to bring that back down the line.

In reference to the above, I'd actually prefer putting them back into
zswpin/zswpout. Sure, they're not handled by zswap.c proper, but this
is arguably just an implementation detail; from a user POV this is
still just (a form of) compression in lieu of IO to the swap backend.

IMO there is no need for coming up with a separate category. Just add
them to zswpin/zswpout and remove the CONFIG_ZSWAP guards from them?


  reply	other threads:[~2024-11-04 16:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-02 10:12 Barry Song
2024-11-02 12:32 ` Usama Arif
2024-11-02 12:59   ` Barry Song
2024-11-02 14:43     ` Usama Arif
2024-11-04 16:24       ` Joshua Hahn
2024-11-04 12:32     ` David Hildenbrand
2024-11-05  3:40       ` Andrew Morton
2024-11-05  8:23         ` David Hildenbrand
2024-11-05  8:24           ` David Hildenbrand
2024-11-05  9:15           ` Barry Song
2024-11-05 10:44             ` Usama Arif
2024-11-05 10:57               ` Barry Song
2024-11-05 11:09             ` David Hildenbrand
2024-11-04 12:42 ` David Hildenbrand
2024-11-04 16:34   ` Johannes Weiner [this message]
2024-11-04 17:10     ` David Hildenbrand
2024-11-04 18:48       ` Usama Arif
2024-11-04 20:56         ` David Hildenbrand
2024-11-04 21:24           ` Usama Arif
2024-11-05  1:28             ` Barry Song
2024-11-05 19:35 ` Nhat Pham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241104163402.GA810664@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=21cnbao@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chengming.zhou@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=ryan.roberts@arm.com \
    --cc=shakeel.butt@linux.dev \
    --cc=usamaarif642@gmail.com \
    --cc=v-songbaohua@oppo.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox