[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aIeU_RSpDYr8eYLz@tardis-2.local>
Date: Mon, 28 Jul 2025 08:19:25 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Miguel Ojeda <ojeda@...nel.org>,
Andrew Ballance <andrewjballance@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, linux-kernel@...r.kernel.org,
maple-tree@...ts.infradead.org, rust-for-linux@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH 2/3] rust: maple_tree: add MapleTree::lock() and load()
On Sat, Jul 26, 2025 at 01:23:23PM +0000, Alice Ryhl wrote:
[...]
> +/// A reference to a [`MapleTree`] that owns the inner lock.
> +///
> +/// # Invariants
> +///
> +/// This guard owns the inner spinlock.
> +pub struct MapleLock<'tree, T: ForeignOwnable>(&'tree MapleTree<T>);
So it's a guard, how about we name it `MapleGuard`, or `MapleLockGuard`,
or just `Guard`?
Regards,
Boqun
> +
> +impl<'tree, T: ForeignOwnable> Drop for MapleLock<'tree, T> {
> + #[inline]
> + fn drop(&mut self) {
> + // SAFETY: By the type invariants, we hold this spinlock.
> + unsafe { bindings::spin_unlock(self.0.ma_lock()) };
> + }
> +}
> +
[...]
Powered by blists - more mailing lists