[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aW2C-A5a7gfNENcb@tardis-2.local>
Date: Mon, 19 Jan 2026 09:03:52 +0800
From: Boqun Feng <boqun.feng@...il.com>
To: Dirk Behme <dirk.behme@...il.com>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
rcu@...r.kernel.org, Miguel Ojeda <ojeda@...nel.org>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Mark Rutland <mark.rutland@....com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Frederic Weisbecker <frederic@...nel.org>,
Neeraj Upadhyay <neeraj.upadhyay@...nel.org>,
Joel Fernandes <joelagnelf@...dia.com>,
Josh Triplett <josh@...htriplett.org>,
Uladzislau Rezki <urezki@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Zqiang <qiang.zhang@...ux.dev>,
FUJITA Tomonori <fujita.tomonori@...il.com>
Subject: Re: [PATCH 5/5] rust: sync: rcu: Add RCU protected pointer
On Sun, Jan 18, 2026 at 09:28:35AM +0100, Dirk Behme wrote:
[...]
> > + /// ```
> > + pub fn dereference<'rcu>(&self, _rcu_guard: &'rcu Guard) -> Option<P::Borrowed<'rcu>> {
> > + // Ordering: Address dependency pairs with the `store(Release)` in copy_update().
> > + let ptr = self.as_atomic().load(Relaxed);
> > +
> > + if !ptr.is_null() {
> > + // SAFETY:
>
>
> Would it be an option to take an early return here and with this drop
> one indentation level of the larger `SAFETY` comment?
>
> if ptr.is_null() {
> return None;
> }
>
> // SAFETY:
> ...
> Some(unsafe { P::borrow(ptr) })
>
> Same for `Drop for Rcu<P>` below.
>
>
Make sense.
> > + // - Since `ptr` is not null, so it has to be a return value of `P::into_foreign()`.
> > + // - The returned `Borrowed<'rcu>` cannot outlive the RCU Guar, this guarantees the
>
> Guar -> Guard
>
Fixed! Thank you!
Regards,
Boqun
Powered by blists - more mailing lists