linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
To: Christopher Li <chrisl@kernel.org>
Cc: "Yosry Ahmed" <yosryahmed@google.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	"Wei Xu" <weixugc@google.com>, "Yu Zhao" <yuzhao@google.com>,
	"Greg Thelen" <gthelen@google.com>,
	"Chun-Tse Shao" <ctshao@google.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Brain Geffon" <bgeffon@google.com>,
	"Minchan Kim" <minchan@kernel.org>,
	"Michal Hocko" <mhocko@suse.com>,
	"Mel Gorman" <mgorman@techsingularity.net>,
	"Huang Ying" <ying.huang@intel.com>,
	"Nhat Pham" <nphamcs@gmail.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Kairui Song" <kasong@tencent.com>,
	"Zhongkun He" <hezhongkun.hzk@bytedance.com>,
	"Kemeng Shi" <shikemeng@huaweicloud.com>,
	"Barry Song" <v-songbaohua@oppo.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Chengming Zhou" <zhouchengming@bytedance.com>
Subject: Re: [PATCH 0/2] RFC: zswap tree use xarray instead of RB tree
Date: Thu, 18 Jan 2024 13:59:18 -0500	[thread overview]
Message-ID: <20240118180959.gwqphdgmf7r5sdne@revolver> (raw)
In-Reply-To: <CANeU7Q=mphnSfiZRwFhqFTy56d2ifa5Pz-aa1h3O1PXUo_cu=Q@mail.gmail.com>

* Christopher Li <chrisl@kernel.org> [240118 01:48]:
> On Wed, Jan 17, 2024 at 10:02 PM Yosry Ahmed <yosryahmed@google.com> wrote:
> >
> > That's a long CC list for sure :)
> >
> > On Wed, Jan 17, 2024 at 7:06 PM Chris Li <chrisl@kernel.org> wrote:
> > >
> > > The RB tree shows some contribution to the swap fault
> > > long tail latency due to two factors:
> > > 1) RB tree requires re-balance from time to time.
> > > 2) The zswap RB tree has a tree level spin lock protecting
> > > the tree access.
> > >
> > > The swap cache is using xarray. The break down the swap
> > > cache access does not have the similar long time as zswap
> > > RB tree.
> >
> > I think the comparison to the swap cache may not be valid as the swap
> > cache has many trees per swapfile, while zswap has a single tree.
> 
> Yes, good point. I think we can bench mark the xarray zswap vs the RB
> tree zswap, that would be more of a direct comparison.
> 
> > > Moving the zswap entry to xarray enable read side
> > > take read RCU lock only.
> >
> > Nice.
> >
> > >
> > > The first patch adds the xarray alongside the RB tree.
> > > There is some debug check asserting the xarray agrees with
> > > the RB tree results.
> > >
> > > The second patch removes the zwap RB tree.
> >
> > The breakdown looks like something that would be a development step,
> > but for patch submission I think it makes more sense to have a single
> > patch replacing the rbtree with an xarray.
> 
> I think it makes the review easier. The code adding and removing does
> not have much overlap. Combining it to a single patch does not save
> patch size. Having the assert check would be useful for some bisecting
> to narrow down which step causing the problem. I am fine with squash
> it to one patch as well.

I had thought similar when I replaced the rbtree with the maple tree in
the VMA space.  That conversion was more involved and I wanted to detect
if there was ever any difference, and where I had made the error in the
multiple patch conversion.

This became rather painful once an issue was found, as then anyone
bisecting other issues could hit this difference and either blamed the
commit pointing at the BUG_ON() or gave up (I don't blame them for
giving up, I would).  With only two commits, it may be easier for people
to see a fixed tag pointing to the same commit that bisect found (if
they check), but it proved an issue with my multiple patch conversion.

You may not experience this issue with the users of the zswap, but I
plan to avoid doing this again in the future.  At least a WARN_ON_ONCE()
and a comment might help?

Thanks,
Liam


  parent reply	other threads:[~2024-01-18 19:00 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18  3:05 Chris Li
2024-01-18  3:05 ` [PATCH 1/2] mm: zswap.c: add xarray tree to zswap Chris Li
2024-01-18  6:20   ` Yosry Ahmed
2024-01-18 13:52     ` Matthew Wilcox
2024-01-18 16:59       ` Yosry Ahmed
2024-01-18 18:25         ` Matthew Wilcox
2024-01-19  5:28           ` Chris Li
2024-01-19 19:30             ` Yosry Ahmed
2024-01-19  5:24     ` Chris Li
2024-01-19 19:29       ` Yosry Ahmed
2024-01-19 20:04         ` Matthew Wilcox
2024-01-19 21:41           ` Yosry Ahmed
2024-01-19 22:05             ` Chris Li
2024-01-19 22:08               ` Yosry Ahmed
2024-01-18  3:05 ` [PATCH 2/2] mm: zswap.c: remove RB tree Chris Li
2024-01-18  6:35   ` Yosry Ahmed
2024-01-18 19:35     ` Yosry Ahmed
2024-01-19  5:49       ` Chris Li
2024-01-19 19:37         ` Yosry Ahmed
2024-01-19  5:43     ` Chris Li
2024-01-19 19:36       ` Yosry Ahmed
2024-01-19 21:31         ` Chris Li
2024-01-19 21:44           ` Yosry Ahmed
2024-01-18  6:01 ` [PATCH 0/2] RFC: zswap tree use xarray instead of " Yosry Ahmed
2024-01-18  6:39   ` Yosry Ahmed
2024-01-18  6:57     ` Chengming Zhou
2024-01-18  7:02       ` Yosry Ahmed
2024-01-18  7:19         ` Chris Li
2024-01-18  7:35           ` Chengming Zhou
2024-01-19  4:59             ` Chris Li
2024-01-19  6:18               ` Chengming Zhou
2024-01-19 10:26                 ` Chris Li
2024-01-19 11:12                   ` Chengming Zhou
2024-01-19 11:59                     ` Chris Li
2024-01-18  6:48   ` Christopher Li
2024-01-18  7:05     ` Yosry Ahmed
2024-01-18  7:28       ` Chris Li
2024-01-18 17:14         ` Yosry Ahmed
2024-01-18 14:48       ` Johannes Weiner
2024-01-18 18:59     ` Liam R. Howlett [this message]
2024-01-19  5:13       ` Chris Li
2024-01-18 18:01 ` Nhat Pham
2024-01-19  5:14   ` 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=20240118180959.gwqphdgmf7r5sdne@revolver \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=bgeffon@google.com \
    --cc=chrisl@kernel.org \
    --cc=ctshao@google.com \
    --cc=gthelen@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=hezhongkun.hzk@bytedance.com \
    --cc=joel@joelfernandes.org \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=surenb@google.com \
    --cc=v-songbaohua@oppo.com \
    --cc=weixugc@google.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=yosryahmed@google.com \
    --cc=yuzhao@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