From: "Nicolás Antinori" <nico.antinori.7@gmail.com>
To: "Tran Van Tien" <7enlab@gmail.com>, <ojeda@kernel.org>
Cc: <boqun@kernel.org>, <gary@garyguo.net>,
<bjorn3_gh@protonmail.com>, <lossin@kernel.org>,
<a.hindborg@kernel.org>, <aliceryhl@google.com>,
<tmgross@umich.edu>, <dakr@kernel.org>,
<daniel.almeida@collabora.com>, <tamird@kernel.org>,
<acourbot@nvidia.com>, <work@onurozkan.dev>,
<rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<oliver.mangold@pm.me>, <igor.korotin@linux.dev>,
"Trevor Chan" <trev@trevrosa.dev>, <vireshk@kernel.org>,
<ukleinek@kernel.org>
Subject: Re: [PATCH v3] rust: sync: make AlwaysRefCounted::inc_ref an associated function
Date: Thu, 26 Nov 2026 10:48:20 -0300 [thread overview]
Message-ID: <DN56UDHKNLEC.22J1K2RGIUUJ0@gmail.com> (raw)
In-Reply-To: <1795689815.75b422ec@gmail.com>
On Thu Nov 26, 2026 at 7:43 AM -03, Tran Van Tien wrote:
> In-Reply-To: <1795684556.6d661f19@gmail.com>
> References: <1795684556.6d661f19@gmail.com>
>
> Incrementing a reference count must be a deliberate act, and every
> inc_ref must be matched by exactly one dec_ref. Making inc_ref an
> associated function that takes a NonNull<Self> mirrors dec_ref, which
> is already an associated function because the object is freed when the
> count reaches zero.
>
> Having one half of the protocol take a reference and the other half a
> raw pointer makes the pairing harder to review and easier to get wrong.
>
> This was suggested by Benno Lossin.
>
> Suggested-by: Benno Lossin <lossin@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1177
> Signed-off-by: Tran Van Tien <7enlab@gmail.com>
> --
Hello! There is a patch that implement this [1] with some 'Reviewed-by:'
tags.
The last patch is from June, maybe it can be coordinated with Trevor
Chan or you to take it over if it needs some updates.
Regards
[1] https://lore.kernel.org/rust-for-linux/20260628100731.64885-1-trev@trevrosa.dev/
next prev parent reply other threads:[~2026-11-26 13:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <OToxFKfgF7gRhE7bRLNCy8rCFgDYsz3vWShTvaBIm5_P087CsaSTZlwyx4vhVvAruJaRUGhZMg9GJoY02B5qcQ==@protonmail.internalid>
2026-11-26 9:15 ` [PATCH] rust: sync: make `AlwaysRefCounted::inc_ref` " Tran Van Tien
2026-11-26 10:22 ` [PATCH v2] rust: sync: make AlwaysRefCounted::inc_ref " Tran Van Tien
2026-11-26 10:43 ` [PATCH v3] " Tran Van Tien
2026-11-26 10:55 ` Andreas Hindborg
2026-11-26 13:48 ` Nicolás Antinori [this message]
2026-11-26 13:57 ` Tran Van Tien
2026-11-26 10:36 ` [PATCH] rust: sync: make `AlwaysRefCounted::inc_ref` " 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=DN56UDHKNLEC.22J1K2RGIUUJ0@gmail.com \
--to=nico.antinori.7@gmail.com \
--cc=7enlab@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=igor.korotin@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=oliver.mangold@pm.me \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=trev@trevrosa.dev \
--cc=ukleinek@kernel.org \
--cc=vireshk@kernel.org \
--cc=work@onurozkan.dev \
/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
all inboxes | Powered by JetHome®