From: Joel Fernandes <joelagnelf@nvidia.com>
To: Alice Ryhl <aliceryhl@google.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Boqun Feng <boqun.feng@gmail.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: "Gary Guo" <gary@garyguo.net>, "Miguel Ojeda" <ojeda@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Frederic Weisbecker" <frederic@kernel.org>,
"Neeraj Upadhyay" <neeraj.upadhyay@kernel.org>,
"Josh Triplett" <josh@joshtriplett.org>,
"Uladzislau Rezki" <urezki@gmail.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"Lai Jiangshan" <jiangshanlai@gmail.com>,
Zqiang <qiang.zhang@linux.dev>,
"Andrew Ballance" <andrewjballance@gmail.com>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
rcu@vger.kernel.org, maple-tree@lists.infradead.org,
linux-mm@kvack.org
Subject: Re: [PATCH RFC 1/2] rust: rcu: add RcuBox type
Date: Fri, 16 Jan 2026 11:23:25 -0500 [thread overview]
Message-ID: <ef39d1a7-7f13-436d-adcf-cefd7cd854b4@nvidia.com> (raw)
In-Reply-To: <20260116-rcu-box-v1-1-38ebfbcd53f0@google.com>
On 1/16/2026 10:46 AM, Alice Ryhl wrote:
> +impl<T: Send> Drop for RcuBox<T> {
> + fn drop(&mut self) {
> + // SAFETY: The `rcu_head` field is in-bounds of a valid allocation.
> + let rcu_head = unsafe { &raw mut (*self.0.as_ptr()).rcu_head };
> + if core::mem::needs_drop::<T>() {
> + // SAFETY: `rcu_head` is the `rcu_head` field of `RcuBoxInner<T>`. All users will be
> + // gone in an rcu grace period. This is the destructor, so we may pass ownership of the
> + // allocation.
> + unsafe { bindings::call_rcu(rcu_head, Some(drop_rcu_box::<T>)) };
> + } else {
> + // SAFETY: All users will be gone in an rcu grace period.
> + unsafe { bindings::kvfree_call_rcu(rcu_head, self.0.as_ptr().cast()) };
> + }
> + }
We should probably add support for asynchronous callbacks for Rust instead of
directly calling the bindings in Rcubox. I know Boqun and me talked about that a
while back, and there was a usecase missing. Perhaps, RcuBox is a good use case
for the same?
- Joel
next prev parent reply other threads:[~2026-01-16 16:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 15:46 [PATCH RFC 0/2] rcu box container for Rust + maple tree load_rcu Alice Ryhl
2026-01-16 15:46 ` [PATCH RFC 1/2] rust: rcu: add RcuBox type Alice Ryhl
2026-01-16 16:23 ` Joel Fernandes [this message]
2026-01-16 15:46 ` [PATCH RFC 2/2] rust: maple_tree: add load_rcu() Alice Ryhl
2026-01-17 0:06 ` [PATCH RFC 0/2] rcu box container for Rust + maple tree load_rcu Boqun Feng
2026-01-17 11:55 ` Alice Ryhl
2026-01-17 12:11 ` Boqun Feng
2026-01-17 13:11 ` Boqun Feng
2026-01-17 13:29 ` Alice Ryhl
2026-01-17 14:05 ` Boqun Feng
2026-01-17 15:39 ` Boqun Feng
2026-01-17 16:46 ` Gary Guo
2026-01-17 13:12 ` Alice Ryhl
2026-01-17 14:00 ` Boqun Feng
2026-01-21 12:10 ` Alice Ryhl
2026-01-21 13:14 ` Boqun Feng
2026-01-21 13:21 ` Alice Ryhl
2026-01-21 18:38 ` Paul E. McKenney
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=ef39d1a7-7f13-436d-adcf-cefd7cd854b4@nvidia.com \
--to=joelagnelf@nvidia.com \
--cc=Liam.Howlett@oracle.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=andrewjballance@gmail.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=frederic@kernel.org \
--cc=gary@garyguo.net \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lossin@kernel.org \
--cc=maple-tree@lists.infradead.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=neeraj.upadhyay@kernel.org \
--cc=ojeda@kernel.org \
--cc=paulmck@kernel.org \
--cc=qiang.zhang@linux.dev \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=urezki@gmail.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