From: Lai Jiangshan <jiangshanlai+lkml@gmail.com>
To: Michel Lespinasse <walken@google.com>
Cc: Lai Jiangshan <laijs@linux.alibaba.com>,
LKML <linux-kernel@vger.kernel.org>,
"Paul E . McKenney" <paulmck@kernel.org>,
Oleg Nesterov <oleg@redhat.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Rik van Riel <riel@redhat.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH V2 2/2] rbtree_latch: don't need to check seq when it found a node
Date: Sat, 16 May 2020 12:52:47 +0800 [thread overview]
Message-ID: <CAJhGHyB5BAR2k8OALutExW-Z1iOqjA1s5_vtsU2p2QNa2tE9eg@mail.gmail.com> (raw)
In-Reply-To: <20200516042705.GA82414@google.com>
On Sat, May 16, 2020 at 12:28 PM Michel Lespinasse <walken@google.com> wrote:
>
> On Fri, May 15, 2020 at 03:59:09PM +0000, Lai Jiangshan wrote:
> > latch_tree_find() should be protected by caller via RCU or so.
> > When it find a node in an attempt, the node must be a valid one
> > in RCU's point's of view even the tree is (being) updated with a
> > new node with the same key which is entirely subject to timing
> > anyway.
>
> I'm not sure I buy this. Even if we get a valid node, is it the one we
> were searching for ? I don't see how this could be guaranteed if the
> read raced with a tree rebalancing.
It is valid because ops->comp() returns 0 and it should be
the one we were searching for unless ops->comp() is wrong.
The searched one could be possible just deleted, but it is still
a legitimate searched result in RCU's point's of view.
A tree rebalancing can cause a searching fails to find
an existing target. This is the job of read_seqcount_retry()
to tell you to retry.
>
> --
> Michel "Walken" Lespinasse
> A program is never fully debugged until the last user dies.
next prev parent reply other threads:[~2020-05-16 4:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 12:47 [PATCH 1/2] rbtree_latch: quit searching when reaching to maximum depth Lai Jiangshan
2020-05-15 12:47 ` [PATCH 2/2] rbtree_latch: don't need to check seq when it found a node Lai Jiangshan
2020-05-15 13:04 ` Peter Zijlstra
2020-05-15 13:00 ` [PATCH 1/2] rbtree_latch: quit searching when reaching to maximum depth Peter Zijlstra
2020-05-15 14:39 ` Lai Jiangshan
2020-05-15 15:01 ` Peter Zijlstra
2020-05-15 15:59 ` [PATCH V2 " Lai Jiangshan
2020-05-15 15:59 ` [PATCH V2 2/2] rbtree_latch: don't need to check seq when it found a node Lai Jiangshan
2020-05-16 4:27 ` Michel Lespinasse
2020-05-16 4:52 ` Lai Jiangshan [this message]
2020-05-16 5:03 ` Michel Lespinasse
2020-05-23 0:56 ` [PATCH V2 1/2] rbtree_latch: quit searching when reaching to maximum depth Lai Jiangshan
2020-05-15 13:14 ` [PATCH " Mathieu Desnoyers
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=CAJhGHyB5BAR2k8OALutExW-Z1iOqjA1s5_vtsU2p2QNa2tE9eg@mail.gmail.com \
--to=jiangshanlai+lkml@gmail.com \
--cc=aarcange@redhat.com \
--cc=laijs@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=oleg@redhat.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=walken@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;
as well as URLs for NNTP newsgroup(s).