[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJD7tkZdTtqyZVKOB927YkYsoW76ZaTNrKV3KJnAbA_omaz9fg@mail.gmail.com>
Date: Fri, 18 Oct 2024 15:28:23 -0700
From: Yosry Ahmed <yosryahmed@...gle.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Kairui Song <ryncsn@...il.com>, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>, Johannes Weiner <hannes@...xchg.org>,
Nhat Pham <nphamcs@...il.com>, Chengming Zhou <chengming.zhou@...ux.dev>,
Chris Li <chrisl@...nel.org>, Barry Song <v-songbaohua@...o.com>,
"Huang, Ying" <ying.huang@...el.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm, zswap: don't touch the XArray lock if there is no
entry to free
On Fri, Oct 18, 2024 at 2:38 PM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Fri, Oct 18, 2024 at 02:00:16PM -0700, Yosry Ahmed wrote:
> > On Fri, Oct 18, 2024 at 1:55 PM Matthew Wilcox <willy@...radead.org> wrote:
> > >
> > > On Fri, Oct 18, 2024 at 01:40:18PM -0700, Yosry Ahmed wrote:
> > > > Oh I thought xas_reload() is enough here to check that the entry is
> > > > still there after the lock is acquired. Do we have to start the walk
> > > > over after holding the lock?
> > >
> > > Yes. The entry is guaranteed to still be valid, but the node you're
> > > looking in might have been freed, so you can't modify the node without
> > > making sure the node is still in the tree. We could make that cheaper
> > > than a rewalk, but you're going to need to write that code since you're
> > > the first to want to do something like this.
> >
> > I see, thanks for elaborating.
> >
> > Could you confirm if the current patch with the xas_reset() added
> > would be equivalent to just checking xa_load() before using
> > xa_erase()?
>
> Yes, I think it would, so it's probably a poor tradeoff.
Thanks. Kairui, please feel free to drop this or if you want you can
check if checking xa_load() before xa_erase() helps.
Powered by blists - more mailing lists