On Thu, Dec 3, 2026 at 11:26 AM Philipp Stanner <[email protected]> wrote:
>
> On Wed, 2026-12-02 at 17:06 +0000, Gary Guo wrote:
> > On Wed Dec 2, 2026 at 11:39 AM GMT, Philipp Stanner wrote:
> > > Currently, Rust's RCU abstractions only provide a full
> > > synchronize_rcu(). Many users, however, only want to wait for one grace
> > > period if a specific grace period has not already passed.
> > >
> > > Add RcuState, an object identifying a grace period, and implement a
> > > method to conditionally synchronize for that grace period.
> > >
> > > Signed-off-by: Philipp Stanner <[email protected]>
> > > Suggested-by: Gary Guo <[email protected]>
> >
> > Please ensure `#[inline]` is added as Sashiko points out.
> >
> > Acked-by: Gary Guo <[email protected]>
>
> Thx for the Ack
>
> in this case inline is kind of non-controversial, but I still don't get
> what the inline-rules are for Rust.
>
> Sashiko-bro for example also wants this to be inline, which does not
> seem reasonable to me for status():
>
>
>     unsafe fn __status(&self) -> Result {
>         // SAFETY: Safe by the function's safety requirements.
>         let res = unsafe { (*self.as_raw()).error };
>
>         to_result(res)
>     }
>
>     /// Query a fence's status at the moment of the function call.
>     ///
>     /// If it is signaled, return the fence's result, i.e., determine if it 
> was
>     /// signaled with an error.
>     pub fn status(&self) -> Poll<Result> {
>         // SAFETY: `self` is valid.
>         if unsafe { bindings::dma_fence_is_signaled(self.as_raw()) } {
>             // SAFETY: The fence is signaled. The C backend ensures ordering.
>             let status = unsafe { self.__status() };
>
>             return Poll::Ready(status);
>         }
>
>         Poll::Pending
>     }
>
> In C we spent years explaining to people that the compiler should
> decide what to inline, with only some exceptions. Yet for Rust we shall
> decide ourselves. Why?

We make exactly the same decisions in C when we decide whether to
declare a function as 'static inline' in a header file, or as a normal
function.

Alice

Reply via email to