[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251201160030.6956a834.gary@garyguo.net>
Date: Mon, 1 Dec 2025 16:00:30 +0000
From: Gary Guo <gary@...yguo.net>
To: Oliver Mangold <oliver.mangold@...me>
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>, Andreas Hindborg <a.hindborg@...nel.org>, Alice
Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Benno Lossin
<lossin@...nel.org>, 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>, "Rafael J.
Wysocki" <rafael@...nel.org>, Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, 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>, 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>, Paul Moore <paul@...l-moore.com>, Serge Hallyn
<sergeh@...nel.org>, Asahi Lina <lina+kernel@...hilina.net>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-block@...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,
linux-security-module@...r.kernel.org
Subject: Re: [PATCH v13 2/4] rust: `AlwaysRefCounted` is renamed to
`RefCounted`.
On Mon, 17 Nov 2025 10:07:57 +0000
Oliver Mangold <oliver.mangold@...me> wrote:
> `AlwaysRefCounted` will become a marker trait to indicate that it is
> allowed to obtain an `ARef<T>` from a `&T`, which cannot be allowed for
> types which are also Ownable.
The message needs a rationale for making the change rather than relying
on the reader to deduce so.
For example:
There are types where it may both be referenced counted in some
cases and owned in other. 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.
Best,
Gary
>
> Signed-off-by: Oliver Mangold <oliver.mangold@...me>
> Co-developed-by: Andreas Hindborg <a.hindborg@...nel.org>
> Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
> Suggested-by: Alice Ryhl <aliceryhl@...gle.com>
> ---
> rust/kernel/auxiliary.rs | 7 +++++-
> rust/kernel/block/mq/request.rs | 15 +++++++------
> rust/kernel/cred.rs | 13 ++++++++++--
> rust/kernel/device.rs | 13 ++++++++----
> rust/kernel/device/property.rs | 7 +++++-
> rust/kernel/drm/device.rs | 10 ++++++---
> rust/kernel/drm/gem/mod.rs | 10 ++++++---
> rust/kernel/fs/file.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 | 2 +-
> 18 files changed, 154 insertions(+), 61 deletions(-)
Powered by blists - more mailing lists