linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: "Gary Guo" <gary@garyguo.net>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Dave Ertman" <david.m.ertman@intel.com>,
	"Ira Weiny" <ira.weiny@intel.com>,
	"Leon Romanovsky" <leon@kernel.org>,
	"Paul Moore" <paul@paul-moore.com>,
	"Serge Hallyn" <sergeh@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Christian Brauner" <brauner@kernel.org>,
	"Jan Kara" <jack@suse.cz>,
	"Igor Korotin" <igor.korotin.linux@gmail.com>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	"Viresh Kumar" <vireshk@kernel.org>, "Nishanth Menon" <nm@ti.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <rust-for-linux@vger.kernel.org>,
	<linux-block@vger.kernel.org>,
	<linux-security-module@vger.kernel.org>,
	<dri-devel@lists.freedesktop.org>,
	<linux-fsdevel@vger.kernel.org>, <linux-mm@kvack.org>,
	<linux-pm@vger.kernel.org>, <linux-pci@vger.kernel.org>,
	"Oliver Mangold" <oliver.mangold@pm.me>
Subject: Re: [PATCH v14 2/9] rust: rename `AlwaysRefCounted` to `RefCounted`.
Date: Thu, 05 Feb 2026 13:33:03 +0000	[thread overview]
Message-ID: <DG72EHZAAM5R.2HQMCZGCQFZQ4@garyguo.net> (raw)
In-Reply-To: <DG72CY2P36F9.2O7OIN36KW8F8@garyguo.net>

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@pm.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@pm.me> [1].
>> 
>> Link: https://lore.kernel.org/r/20251117-unique-ref-v13-2-b5b243df1250@pm.me [1]
>> Suggested-by: Alice Ryhl <aliceryhl@google.com>
>> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
>> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.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@garyguo.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(-)



  reply	other threads:[~2026-02-05 13:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 11:56 [PATCH v14 0/9] rust: add `Ownable` trait and `Owned` type Andreas Hindborg
2026-02-04 11:56 ` [PATCH v14 1/9] rust: types: Add Ownable/Owned types Andreas Hindborg
2026-02-04 15:41   ` Danilo Krummrich
2026-02-04 16:06     ` Andreas Hindborg
2026-02-04 16:46       ` Danilo Krummrich
2026-02-04 16:55         ` Gary Guo
2026-02-04 16:56       ` Gary Guo
2026-02-05 13:29   ` Gary Guo
2026-02-04 11:56 ` [PATCH v14 2/9] rust: rename `AlwaysRefCounted` to `RefCounted` Andreas Hindborg
2026-02-04 15:08   ` Igor Korotin
2026-02-04 15:44   ` Danilo Krummrich
2026-02-05  9:54   ` Viresh Kumar
2026-02-05 13:31   ` Gary Guo
2026-02-05 13:33     ` Gary Guo [this message]
2026-02-04 11:56 ` [PATCH v14 3/9] rust: Add missing SAFETY documentation for `ARef` example Andreas Hindborg
2026-02-04 11:56 ` [PATCH v14 4/9] rust: aref: update formatting of use statements Andreas Hindborg
2026-02-04 11:56 ` [PATCH v14 5/9] rust: Add `OwnableRefCounted` Andreas Hindborg
2026-02-04 11:56 ` [PATCH v14 6/9] rust: page: update formatting of `use` statements Andreas Hindborg
2026-02-04 11:56 ` [PATCH v14 7/9] rust: page: convert to `Ownable` Andreas Hindborg
2026-02-04 11:56 ` [PATCH v14 8/9] rust: implement `ForeignOwnable` for `Owned` Andreas Hindborg
2026-02-04 11:56 ` [PATCH v14 9/9] rust: page: add `from_raw()` Andreas Hindborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DG72EHZAAM5R.2HQMCZGCQFZQ4@garyguo.net \
    --to=gary@garyguo.net \
    --cc=Liam.Howlett@oracle.com \
    --cc=a.hindborg@kernel.org \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bhelgaas@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=brauner@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=david.m.ertman@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=igor.korotin.linux@gmail.com \
    --cc=ira.weiny@intel.com \
    --cc=jack@suse.cz \
    --cc=kwilczynski@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=lossin@kernel.org \
    --cc=nm@ti.com \
    --cc=ojeda@kernel.org \
    --cc=oliver.mangold@pm.me \
    --cc=paul@paul-moore.com \
    --cc=rafael@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sergeh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    --cc=vireshk@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox