Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] rust: rcu: missing #[inline] on RcuState::new() and cond_synchronize() --
commit 9b80e8ce3d2823d6c857be2691481f7b6e1c7968 Author: Philipp Stanner <[email protected]> rust: rcu: Add RcuState This commit adds RcuState to record an RCU grace period cookie via get_state_synchronize_rcu() and conditionally wait for that grace period via cond_synchronize_rcu(). > diff --git a/rust/kernel/sync/rcu.rs b/rust/kernel/sync/rcu.rs > index 0daa1ac87d818..7cb5a7d31e57d 100644 > --- a/rust/kernel/sync/rcu.rs > +++ b/rust/kernel/sync/rcu.rs > @@ -86,3 +86,38 @@ pub fn synchronize_rcu() { > // SAFETY: `synchronize_rcu()` is always safe to be called from process > context. > unsafe { bindings::synchronize_rcu() }; > } > + > +/// An RCU grace period snapshot. > +/// > +/// Useful for waiting for said grace period if necessary. If you just drop > this > +/// object, nothing happens. > +#[derive(Copy, Clone)] > +pub struct RcuState(usize); > + > +impl RcuState { > + /// Create a new RcuState. It stores an identifier of the current grace > + /// period so that you can later water on it. > + pub fn new() -> Self { > + // SAFETY: `get_state_synchronize_rcu()` is always safe to be called. > + let cookie: usize = unsafe { bindings::get_state_synchronize_rcu() }; > + > + Self(cookie) > + } > + > + /// Make sure that a full RCU grace period has passed since this RcuState > + /// was created. > + /// > + /// Executes a [`synchronize_rcu()`] if that's not the case. Thus, you > must > + /// not call this in atomic context. > + pub fn cond_synchronize(self) { > + // SAFETY: This is the right cookie. The function runs in process > context. > + unsafe { bindings::cond_synchronize_rcu(self.0) }; > + } > +} [Severity: Low] Should RcuState::new() and RcuState::cond_synchronize() be marked #[inline] like the other C binding wrappers in this module so callers in other crates can inline them? -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
