[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5fLghKXePs1bJA1pHtnofKRmbwEt_PjdB380-zjQZ4PSxzgA@mail.gmail.com>
Date: Fri, 21 Feb 2025 12:05:27 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Gary Guo <gary@...yguo.net>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, Tamir Duberstein <tamird@...il.com>,
Wedson Almeida Filho <walmeida@...rosoft.com>, Alex Mantel <alexmantel93@...lbox.org>,
Will Deacon <will@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
Mark Rutland <mark.rutland@....com>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/4] rust: convert `Arc` to use `Refcount`
On Wed, Feb 19, 2025 at 8:17 PM Gary Guo <gary@...yguo.net> wrote:
>
> With `Refcount` type created, `Arc` can use `Refcount` instead of
> calling into FFI directly.
>
> Signed-off-by: Gary Guo <gary@...yguo.net>
Overall LGTM. Other than Tamir's questions, I have one:
> + if refcount.dec_and_test() {
> + refcount.set(1);
>
> - // INVARIANT: We own the only refcount to this arc, so we may create a `UniqueArc`. We
> - // must pin the `UniqueArc` because the values was previously in an `Arc`, and they pin
> - // their values.
> + // INVARIANT: If the refcount failed to decrement because it is 1, then we have the
> + // exclusive ownership, so we may create a `UniqueArc`. We must pin the `UniqueArc`
> + // because the values was previously in an `Arc`, and they pin their values.
"If the refcount failed to decrement" seems to be leftover from a
previous version. This should say "If the refcount was decremented to
zero" or similar.
Alice
Powered by blists - more mailing lists