linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Kairui Song <ryncsn@gmail.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Nhat Pham <nphamcs@gmail.com>,
	Chengming Zhou <chengming.zhou@linux.dev>,
	Chris Li <chrisl@kernel.org>, Barry Song <v-songbaohua@oppo.com>,
	"Huang, Ying" <ying.huang@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm, zswap: don't touch the XArray lock if there is no entry to free
Date: Fri, 18 Oct 2024 22:38:18 +0100	[thread overview]
Message-ID: <ZxLVSkEr_Zd2Ai3Q@casper.infradead.org> (raw)
In-Reply-To: <CAJD7tkaycBYvtTCoGsuNUekSDNnE5SZb-XyS5a8j83JsKQw4FQ@mail.gmail.com>

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@infradead.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.


  reply	other threads:[~2024-10-18 21:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 19:25 Kairui Song
2024-10-18 19:46 ` Matthew Wilcox
2024-10-18 20:01   ` Kairui Song
2024-10-18 20:40     ` Yosry Ahmed
2024-10-18 20:55       ` Matthew Wilcox
2024-10-18 21:00         ` Yosry Ahmed
2024-10-18 21:38           ` Matthew Wilcox [this message]
2024-10-18 22:28             ` Yosry Ahmed
2024-10-18 22:38     ` Johannes Weiner

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=ZxLVSkEr_Zd2Ai3Q@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=ryncsn@gmail.com \
    --cc=v-songbaohua@oppo.com \
    --cc=ying.huang@intel.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