Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The function name `rcu_barrier` causes module-level stuttering (`rcu::rcu_barrier()`). --
commit 7b2bfcaf9137cfae11ac6cf2b69d559a4e731460 Author: Philipp Stanner <[email protected]> rust: sync: Add abstraction for rcu_barrier() This commit adds a safe Rust abstraction for the C function rcu_barrier(), which waits for all in-flight call_rcu() callbacks to complete. > diff --git a/rust/kernel/sync/rcu.rs b/rust/kernel/sync/rcu.rs > index a32bef6e490b0..7031ca5d24738 100644 > --- a/rust/kernel/sync/rcu.rs > +++ b/rust/kernel/sync/rcu.rs [ ... ] > @@ -50,3 +50,23 @@ fn drop(&mut self) { > pub fn read_lock() -> Guard { > Guard::new() > } > + > +/// Wait until all in-flight call_rcu() callbacks complete. > +/// > +/// Note that this primitive does not necessarily wait for an RCU grace > period > +/// to complete. For example, if there are no RCU callbacks queued anywhere > +/// in the system, then rcu_barrier() is within its rights to return > +/// immediately, without waiting for anything, much less an RCU grace period. > +/// In fact, rcu_barrier() will normally not result in any RCU grace periods > +/// beyond those that were already destined to be executed. > +/// > +/// In kernels built with CONFIG_RCU_LAZY=y, this function also hurries all > +/// pending lazy RCU callbacks. > +/// > +/// Note that this is one of the RCU primitives which must not be called in > +/// atomic context. > +#[inline] > +pub fn rcu_barrier() { [Severity: Low] This isn't a bug, but naming this function rcu_barrier() inside the rcu module leads to stuttering when called (i.e., rcu::rcu_barrier()). Would it be better to name this simply barrier() so it can be called as rcu::barrier(), similar to how rcu_read_lock() is exposed as rcu::read_lock()? > + // SAFETY: `rcu_barrier()` is always safe to be called. It just might > wait for a grace period. > + unsafe { bindings::rcu_barrier() }; > +} -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
