|
|
Log in / Subscribe / Register

rust: sync: Introduce Rcu*Box

From:  Boqun Feng <boqun-AT-kernel.org>
To:  linux-kernel-AT-vger.kernel.org, rust-for-linux-AT-vger.kernel.org, rcu-AT-vger.kernel.org
Subject:  [PATCH 0/3] rust: sync: Introduce Rcu*Box
Date:  Fri, 05 Jun 2026 06:35:36 -0700
Message-ID:  <20260605133541.22569-1-boqun@kernel.org>
Cc:  Miguel Ojeda <ojeda-AT-kernel.org>, Boqun Feng <boqun-AT-kernel.org>, Gary Guo <gary-AT-garyguo.net>, Björn Roy Baron <bjorn3_gh-AT-protonmail.com>, Benno Lossin <lossin-AT-kernel.org>, Andreas Hindborg <a.hindborg-AT-kernel.org>, Alice Ryhl <aliceryhl-AT-google.com>, Trevor Gross <tmgross-AT-umich.edu>, Danilo Krummrich <dakr-AT-kernel.org>, "Liam R. Howlett" <liam-AT-infradead.org>, Andrew Ballance <andrewjballance-AT-gmail.com>, "Paul E. McKenney" <paulmck-AT-kernel.org>, Frederic Weisbecker <frederic-AT-kernel.org>, Neeraj Upadhyay <neeraj.upadhyay-AT-kernel.org>, Joel Fernandes <joelagnelf-AT-nvidia.com>, Josh Triplett <josh-AT-joshtriplett.org>, Uladzislau Rezki <urezki-AT-gmail.com>, Steven Rostedt <rostedt-AT-goodmis.org>, Mathieu Desnoyers <mathieu.desnoyers-AT-efficios.com>, Lai Jiangshan <jiangshanlai-AT-gmail.com>, Zqiang <qiang.zhang-AT-linux.dev>, Sumit Semwal <sumit.semwal-AT-linaro.org>, Christian König <christian.koenig-AT-amd.com>, maple-tree-AT-lists.infradead.org, linux-mm-AT-kvack.org, linux-media-AT-vger.kernel.org, dri-devel-AT-lists.freedesktop.org, Philipp Stanner <phasta-AT-kernel.org>, Lyude Paul <lyude-AT-redhat.com>, Daniel Almeida <daniel.almeida-AT-collabora.com>, Onur Özkan <work-AT-onurozkan.dev>
Archive-link:  Article

(this series is based on Alice's RFC [1] and discussion around Philipp's
patches [2], [3])

As an easy way to provide RCU-protected allocation, two major types are
provided:

- `RcuBox<T, A>`, inner T will be dropped and after a grace period.
  Users: binder with maple_tree and dma_fence.
- `RcuFreeBox<T, A>`, inner T will be cleaned up immmediately and freed
  after a grace period. (Name suggestion is welcome). This is an attempt
  to consolidate Alice's `PollCondVarBox` [4] into a generic
  implementation, InPlaceInit support is still missing, but I want to
  get some feedback on the trait `RcuFreeSafe`.


[1]: https://lore.kernel.org/rust-for-linux/20260116-rcu-box-v...
[2]: https://lore.kernel.org/rust-for-linux/20260530143541.229...
[3]: https://lore.kernel.org/rust-for-linux/20260520131725.266...
[4]: https://lore.kernel.org/rust-for-linux/20260523-upgrade-p...

Regards,
Boqun

Alice Ryhl (2):
  rust: rcu: Add RcuBox type
  rust: maple_tree: Add load_rcu()

Boqun Feng (1):
  rust: rcu: Introduce RcuFreeBox

 rust/bindings/bindings_helper.h |   1 +
 rust/kernel/maple_tree.rs       |  52 ++++++
 rust/kernel/sync/rcu.rs         |  65 ++++++-
 rust/kernel/sync/rcu/rcu_box.rs | 290 ++++++++++++++++++++++++++++++++
 4 files changed, 407 insertions(+), 1 deletion(-)
 create mode 100644 rust/kernel/sync/rcu/rcu_box.rs

-- 
2.51.0




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds