linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chris Li <chrisl@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	 Yosry Ahmed <yosryahmed@google.com>,
	Nhat Pham <nphamcs@gmail.com>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Chengming Zhou <zhouchengming@bytedance.com>,
	 Barry Song <v-songbaohua@oppo.com>
Subject: Re: [PATCH v8] zswap: replace RB tree with xarray
Date: Mon, 25 Mar 2024 14:29:41 -0700	[thread overview]
Message-ID: <CANeU7QkDuXeR8MzKvnPcN5odkpDQJ3bMW_nSRHbZGffPkiXW-Q@mail.gmail.com> (raw)
In-Reply-To: <20240325133546.ffd728d1c309ba58eadb179c@linux-foundation.org>

On Mon, Mar 25, 2024 at 1:35 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Wed, 20 Mar 2024 12:31:38 -0700 Chris Li <chrisl@kernel.org> wrote:
>
> > Very deep RB tree requires rebalance at times. That
> > contributes to the zswap fault latencies. Xarray does not
> > need to perform tree rebalance. Replacing RB tree to xarray
> > can have some small performance gain.
> >
> > One small difference is that xarray insert might fail with
> > ENOMEM, while RB tree insert does not allocate additional
> > memory.
> >
> > The zswap_entry size will reduce a bit due to removing the
> > RB node, which has two pointers and a color field. Xarray
> > store the pointer in the xarray tree rather than the
> > zswap_entry. Every entry has one pointer from the xarray
> > tree. Overall, switching to xarray should save some memory,
> > if the swap entries are densely packed.
> >
> > Notice the zswap_rb_search and zswap_rb_insert always
> > followed by zswap_rb_erase. Use xa_erase and xa_store
> > directly. That saves one tree lookup as well.
> >
> > Remove zswap_invalidate_entry due to no need to call
> > zswap_rb_erase any more. Use zswap_free_entry instead.
> >
> > The "struct zswap_tree" has been replaced by "struct xarray".
> > The tree spin lock has transferred to the xarray lock.
> >
> > Run the kernel build testing 10 times for each version, averages:
> > (memory.max=2GB, zswap shrinker and writeback enabled,
> > one 50GB swapfile, 24 HT core, 32 jobs)
> >
>
> So this conflits with Johannes's "mm: zswap: fix data loss on
> SWP_SYNCHRONOUS_IO devices", right in the critical part of
> zswap_load().  Naive resolution of that conflict would have resulted in
> basically reverting Johannes's fix.
>
> That fix is cc:stable so we do want it to have a clean run in
> linux-next before sending it upstream.  So I'll drop this patch
> ("zswap: replace RB tree with xarray") for now.  Please redo it against
> latest mm-unstable and of course, be sure to preserve Johannes's fix,
> thanks.

Sure, I will wait for your mm-unstable update that contains Jonanne's
fix then re-submit a new version.

Chris


  reply	other threads:[~2024-03-25 21:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 19:31 Chris Li
2024-03-21  3:07 ` Chengming Zhou
2024-03-25 20:35 ` Andrew Morton
2024-03-25 21:29   ` Chris Li [this message]
2024-03-25 21:34     ` Andrew Morton

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=CANeU7QkDuXeR8MzKvnPcN5odkpDQJ3bMW_nSRHbZGffPkiXW-Q@mail.gmail.com \
    --to=chrisl@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=v-songbaohua@oppo.com \
    --cc=yosryahmed@google.com \
    --cc=zhouchengming@bytedance.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