[RFC PATCH v2 0/4] rust: sync: Introduce Rcu*Box

From: Boqun Feng

Date: Sat Jul 18 2026 - 01:33:05 EST


v1: https://lore.kernel.org/rust-for-linux/20260605133541.22569-1-boqun@xxxxxxxxxx/

Changes since v1:

* Rebased on 7.2-rc1
* As Alice pointed out [5], RcuFreeBox::with_rcu() should return a type
that disallows extending the RCU read-side critical section to
outlive the guard. As for now, no user needs with_rcu(), hence remove
it.

* Includes a not-for-merge example based on Alice's patch.

v1's cover letter
-----------------

(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-v1-0-38ebfbcd53f0@xxxxxxxxxx/
[2]: https://lore.kernel.org/rust-for-linux/20260530143541.229628-2-phasta@xxxxxxxxxx/
[3]: https://lore.kernel.org/rust-for-linux/20260520131725.266014-2-phasta@xxxxxxxxxx/
[4]: https://lore.kernel.org/rust-for-linux/20260523-upgrade-poll-v4-0-f5b4c747eac2@xxxxxxxxxx/
[5]: https://lore.kernel.org/rust-for-linux/aiLXWHg22P6OTb7O@xxxxxxxxxx/

--
2.50.1 (Apple Git-155)