From: Peter Zijlstra <peterz@infradead.org>
To: Christian Brauner <brauner@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>,
Jeff Layton <jlayton@kernel.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 3/8] fs: lockless mntns rbtree lookup
Date: Thu, 12 Dec 2024 13:09:29 +0100 [thread overview]
Message-ID: <20241212120929.GY21636@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20241212-work-mount-rbtree-lockless-v2-3-4fe6cef02534@kernel.org>
On Thu, Dec 12, 2024 at 12:56:02PM +0100, Christian Brauner wrote:
> @@ -16,7 +16,10 @@ struct mnt_namespace {
> u64 event;
> unsigned int nr_mounts; /* # of mounts in the namespace */
> unsigned int pending_mounts;
> - struct rb_node mnt_ns_tree_node; /* node in the mnt_ns_tree */
> + union {
> + struct rb_node mnt_ns_tree_node; /* node in the mnt_ns_tree */
> + struct rcu_head mnt_ns_rcu;
> + };
> refcount_t passive; /* number references not pinning @mounts */
> } __randomize_layout;
> static void mnt_ns_tree_remove(struct mnt_namespace *ns)
> {
> /* remove from global mount namespace list */
> if (!is_anon_ns(ns)) {
> - guard(write_lock)(&mnt_ns_tree_lock);
> + mnt_ns_tree_write_lock();
> rb_erase(&ns->mnt_ns_tree_node, &mnt_ns_tree);
> + mnt_ns_tree_write_unlock();
> }
>
> - mnt_ns_release(ns);
> + call_rcu(&ns->mnt_ns_rcu, mnt_ns_release_rcu);
> }
I'm not sure that union is sane; the above means you're overwriting the
tree node while a concurrent lookup might still see the node and want to
decent from it.
next prev parent reply other threads:[~2024-12-12 12:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-12 11:55 [PATCH v2 0/8] fs: lockless mntns lookup Christian Brauner
2024-12-12 11:56 ` [PATCH v2 1/8] mount: remove inlude/nospec.h include Christian Brauner
2024-12-12 11:56 ` [PATCH v2 2/8] fs: add mount namespace to rbtree late Christian Brauner
2024-12-12 11:56 ` [PATCH v2 3/8] fs: lockless mntns rbtree lookup Christian Brauner
2024-12-12 12:09 ` Peter Zijlstra [this message]
2024-12-12 17:35 ` Christian Brauner
2024-12-12 12:15 ` Jeff Layton
2024-12-12 17:34 ` Christian Brauner
2024-12-12 11:56 ` [PATCH v2 4/8] rculist: add list_bidir_{del,prev}_rcu() Christian Brauner
2024-12-12 15:18 ` Paul E. McKenney
2024-12-12 17:40 ` Christian Brauner
2024-12-12 18:27 ` Paul E. McKenney
2024-12-12 11:56 ` [PATCH v2 5/8] fs: lockless mntns lookup for nsfs Christian Brauner
2024-12-12 12:48 ` Peter Zijlstra
2024-12-12 17:33 ` Christian Brauner
2024-12-12 18:24 ` Christian Brauner
2024-12-12 11:56 ` [PATCH v2 6/8] fs: simplify rwlock to spinlock Christian Brauner
2024-12-12 11:56 ` [PATCH v2 7/8] selftests: remove unneeded include Christian Brauner
2024-12-12 11:56 ` [PATCH v2 8/8] samples: add test-list-all-mounts Christian Brauner
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=20241212120929.GY21636@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=brauner@kernel.org \
--cc=jlayton@kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=paulmck@kernel.org \
/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