[PATCH v2 3/6] rust: sync: Add abstraction for synchronize_rcu()

From: Philipp Stanner

Date: Tue Jun 16 2026 - 04:34:58 EST


synchronize_rcu() is a frequently used C function which is always safe
to be called.

Add a safe abstraction for synchronize_rcu().

Signed-off-by: Philipp Stanner <phasta@xxxxxxxxxx>
---
rust/kernel/sync/rcu.rs | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/rust/kernel/sync/rcu.rs b/rust/kernel/sync/rcu.rs
index eef34bf86259..d86d615467b1 100644
--- a/rust/kernel/sync/rcu.rs
+++ b/rust/kernel/sync/rcu.rs
@@ -56,3 +56,11 @@ pub fn rcu_barrier() {
// SAFETY: `rcu_barrier()` is always safe to be called. It just might wait for a grace period.
unsafe { bindings::rcu_barrier() };
}
+
+/// Wait for one RCU grace period.
+///
+/// You typically do this to wait for everyone holding a [`Guard`].
+pub fn synchronize_rcu() {
+ // SAFETY: `synchronize_rcu()` is always safe to be called. It just waits for a grace period.
+ unsafe { bindings::synchronize_rcu() };
+}
--
2.54.0