linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yosry Ahmed <yosryahmed@google.com>
To: David Laight <David.Laight@aculab.com>
Cc: "'Chris Li'" <chrisl@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	 Nhat Pham <nphamcs@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	 "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Chengming Zhou <zhouchengming@bytedance.com>,
	 Barry Song <v-songbaohua@oppo.com>
Subject: Re: [PATCH v2] zswap: replace RB tree with xarray
Date: Tue, 5 Mar 2024 03:08:15 +0000	[thread overview]
Message-ID: <ZeaMn488S_xVNtAh@google.com> (raw)
In-Reply-To: <26e77602326d4e169a9484314cac2465@AcuMS.aculab.com>

On Fri, Mar 01, 2024 at 09:58:43PM +0000, David Laight wrote:
> From: Chris Li
> > Sent: 29 February 2024 08:46
> > 
> > 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.
> 
> What is the difference in kernel memory use?
> IIRC someone pointed out (in the rosebush thread) that xarray
> uses a lot of kernel memory if the items are randomly distributed.

I often thought it would be useful if there is an API for the xarray to
report how much memory it's using. For zswap, we could plumb this to a
debugfs interface or so to measure the tree usage and compare to the
rbtree. The cost is fixed with the rbtree IIUC, 3 words per zswap entry.


      parent reply	other threads:[~2024-03-05  3:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29  8:46 [PATCH v2] zswap: replace RB tree with xarray Chris Li
2024-02-29  9:44 ` Chengming Zhou
2024-02-29 18:58   ` Chris Li
2024-03-01  7:24     ` Chengming Zhou
2024-03-01  9:38       ` Chris Li
2024-03-02 18:33         ` Chris Li
2024-03-01 21:58 ` David Laight
2024-03-01 22:33   ` Chris Li
2024-03-05  3:08   ` Yosry Ahmed [this message]

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=ZeaMn488S_xVNtAh@google.com \
    --to=yosryahmed@google.com \
    --cc=David.Laight@aculab.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisl@kernel.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=willy@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).