[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DG72EHZAAM5R.2HQMCZGCQFZQ4@garyguo.net>
Date: Thu, 05 Feb 2026 13:33:03 +0000
From: "Gary Guo" <gary@...yguo.net>
To: "Gary Guo" <gary@...yguo.net>, "Andreas Hindborg"
<a.hindborg@...nel.org>, "Miguel Ojeda" <ojeda@...nel.org>, "Boqun Feng"
<boqun.feng@...il.com>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Benno Lossin" <lossin@...nel.org>, "Alice
Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>, "Danilo
Krummrich" <dakr@...nel.org>, "Greg Kroah-Hartman"
<gregkh@...uxfoundation.org>, "Dave Ertman" <david.m.ertman@...el.com>,
"Ira Weiny" <ira.weiny@...el.com>, "Leon Romanovsky" <leon@...nel.org>,
"Paul Moore" <paul@...l-moore.com>, "Serge Hallyn" <sergeh@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, "David Airlie"
<airlied@...il.com>, "Simona Vetter" <simona@...ll.ch>, "Alexander Viro"
<viro@...iv.linux.org.uk>, "Christian Brauner" <brauner@...nel.org>, "Jan
Kara" <jack@...e.cz>, "Igor Korotin" <igor.korotin.linux@...il.com>,
"Daniel Almeida" <daniel.almeida@...labora.com>, "Lorenzo Stoakes"
<lorenzo.stoakes@...cle.com>, "Liam R. Howlett" <Liam.Howlett@...cle.com>,
"Viresh Kumar" <vireshk@...nel.org>, "Nishanth Menon" <nm@...com>, "Stephen
Boyd" <sboyd@...nel.org>, "Bjorn Helgaas" <bhelgaas@...gle.com>,
Krzysztof Wilczyński <kwilczynski@...nel.org>
Cc: <linux-kernel@...r.kernel.org>, <rust-for-linux@...r.kernel.org>,
<linux-block@...r.kernel.org>, <linux-security-module@...r.kernel.org>,
<dri-devel@...ts.freedesktop.org>, <linux-fsdevel@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-pm@...r.kernel.org>,
<linux-pci@...r.kernel.org>, "Oliver Mangold" <oliver.mangold@...me>
Subject: Re: [PATCH v14 2/9] rust: rename `AlwaysRefCounted` to
`RefCounted`.
On Thu Feb 5, 2026 at 1:31 PM GMT, Gary Guo wrote:
> On Wed Feb 4, 2026 at 11:56 AM GMT, Andreas Hindborg wrote:
>> From: Oliver Mangold <oliver.mangold@...me>
>>
>> There are types where it may both be reference counted in some cases and
>> owned in others. In such cases, obtaining `ARef<T>` from `&T` would be
>> unsound as it allows creation of `ARef<T>` copy from `&Owned<T>`.
>>
>> Therefore, we split `AlwaysRefCounted` into `RefCounted` (which `ARef<T>`
>> would require) and a marker trait to indicate that the type is always
>> reference counted (and not `Ownable`) so the `&T` -> `ARef<T>` conversion
>> is possible.
>>
>> - Rename `AlwaysRefCounted` to `RefCounted`.
>> - Add a new unsafe trait `AlwaysRefCounted`.
>> - Implement the new trait `AlwaysRefCounted` for the newly renamed
>> `RefCounted` implementations. This leaves functionality of existing
>> implementers of `AlwaysRefCounted` intact.
>>
>> Original patch by Oliver Mangold <oliver.mangold@...me> [1].
>>
>> Link: https://lore.kernel.org/r/20251117-unique-ref-v13-2-b5b243df1250@pm.me [1]
>> Suggested-by: Alice Ryhl <aliceryhl@...gle.com>
>> Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>
>> Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
>
> I think you also need to update the `AlwaysRefCounted` reference mentioned in
> the `Owned` patch too? (Or perhaps this patch should be moved before `Owned`
> instead?)
Actually I re-read the comment in first patch, the text indeed should refer to
`AlwaysRefCounted`. Please disregard this comment.
Best,
Gary
>
> With that fixed:
>
> Reviewed-by: Gary Guo <gary@...yguo.net>
>
>> ---
>> rust/kernel/auxiliary.rs | 7 +++++-
>> rust/kernel/block/mq/request.rs | 15 +++++++------
>> rust/kernel/cred.rs | 13 ++++++++++--
>> rust/kernel/device.rs | 10 ++++++---
>> rust/kernel/device/property.rs | 7 +++++-
>> rust/kernel/drm/device.rs | 10 ++++++---
>> rust/kernel/drm/gem/mod.rs | 8 ++++---
>> rust/kernel/fs/file.rs | 16 ++++++++++----
>> rust/kernel/i2c.rs | 16 +++++++++-----
>> rust/kernel/mm.rs | 15 +++++++++----
>> rust/kernel/mm/mmput_async.rs | 9 ++++++--
>> rust/kernel/opp.rs | 10 ++++++---
>> rust/kernel/owned.rs | 2 +-
>> rust/kernel/pci.rs | 10 ++++++++-
>> rust/kernel/pid_namespace.rs | 12 +++++++++--
>> rust/kernel/platform.rs | 7 +++++-
>> rust/kernel/sync/aref.rs | 47 ++++++++++++++++++++++++++---------------
>> rust/kernel/task.rs | 10 ++++++---
>> rust/kernel/types.rs | 3 ++-
>> 19 files changed, 164 insertions(+), 63 deletions(-)
Powered by blists - more mailing lists