linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chris Li <chrisl@kernel.org>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Chengming Zhou <chengming.zhou@linux.dev>,
	 Nhat Pham <nphamcs@gmail.com>, Linux-MM <linux-mm@kvack.org>
Subject: Re: [RFC] Storing same-filled pages without a zswap_entry
Date: Thu, 21 Mar 2024 17:28:54 -0700	[thread overview]
Message-ID: <CANeU7Q=tKCejX=w+0M-+GJG2k0txU7kR3dsJ8No9M1gJqJx6BA@mail.gmail.com> (raw)
In-Reply-To: <CAJD7tkZH=UjU6GKC7KPU6bPC_JGTa1j1pn77gSvc9e9MBPEi3g@mail.gmail.com>

On Thu, Mar 21, 2024 at 12:58 PM Yosry Ahmed <yosryahmed@google.com> wrote:
>
> On Thu, Mar 21, 2024 at 12:29 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
> >
> > On Thu, Mar 21, 2024 at 06:44:54PM +0000, Yosry Ahmed wrote:
> > > > In some cases where the current objcg is not "correct", the testcases in
> > > > test_zswap.c may break? Maybe we can use swap_cgroup info to charge the
> > > > stats to the correct memcg? Not sure if this is feasible.
> > >
> > > For cgroup v1, swap_cgroup will be cleared from
> > > mem_cgroup_swapin_uncharge_swap() before the zswap load.
> > >
> > > I think the current objcg will remain correct as long as swapin happens
> > > from the same memcg as swapout (or if swapin happens from the parent
> > > memcg and the swapout memcg was offlined).
> >
> > Swap readahead will pull in physically adjacent entries that may
> > belong to somebody unrelated.
>
> Right. For those as well the current objcg would be correct if they
> are readahead from the same memcg as the one they were swapped out
> from, but I understand your point that readahead makes that more
> likely to not be the case.
>
> I am slightly nervous about using the current objcg tbh, even though
> it only affects the stats. It's just less straightforward this way. I
> think I prefer either:
> (a) Only supporting zero-filled pages and storing the objcg directly
> in the xarray.

We can add the zero-filled page as a special case to speed it up. I
don't think we should remove non zero values of the same fill pages
from zswap though. We can never declare the non zero same filled page
is not going to happen. In that case, the current same fill is still
better than going through the zsmalloc.

Chris

> (b) Having a separate two-word struct to store objcg and value for
> same-filled pages.
>
> In both cases, we would need one tag bit to identify same-filled pages
> in the xarray. (a) is more tempting for me, but I am not sure everyone
> else agrees with dropping support for non-zero same-filled pages.


  reply	other threads:[~2024-03-22  0:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 20:49 Yosry Ahmed
2024-03-20 21:07 ` Johannes Weiner
2024-03-20 21:14   ` Yosry Ahmed
2024-03-20 21:19   ` Johannes Weiner
2024-03-20 21:31     ` Yosry Ahmed
2024-03-21  3:40       ` Chengming Zhou
2024-03-21 18:44         ` Yosry Ahmed
2024-03-21 19:29           ` Johannes Weiner
2024-03-21 19:57             ` Yosry Ahmed
2024-03-22  0:28               ` Chris Li [this message]
2024-03-22  0:37                 ` Yosry Ahmed
2024-03-20 21:42   ` Chris Li
2024-03-21  4:26 ` Chris Li
2024-03-21 18:50   ` Yosry Ahmed
2024-03-22  0:18     ` Chris Li

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='CANeU7Q=tKCejX=w+0M-+GJG2k0txU7kR3dsJ8No9M1gJqJx6BA@mail.gmail.com' \
    --to=chrisl@kernel.org \
    --cc=chengming.zhou@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.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