From: Andreas Hindborg <a.hindborg@kernel.org>
To: Tran Van Tien <7enlab@gmail.com>, ojeda@kernel.org
Cc: boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com,
lossin@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, vireshk@kernel.org,
ukleinek@kernel.org
Subject: Re: [PATCH v3] rust: sync: make AlwaysRefCounted::inc_ref an associated function
Date: Thu, 26 Nov 2026 11:55:34 +0100 [thread overview]
Message-ID: <87y0afuajd.fsf@t14s.mail-host-address-is-not-set> (raw)
In-Reply-To: <1795689815.75b422ec@gmail.com>
Tran Van Tien <7enlab@gmail.com> writes:
> 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>
Please consider rate limiting your resend to at most 1 version every 24
hours.
Please consider using the b4 tool [1].
Best regards,
Andreas Hindborg
[1] https://b4.docs.kernel.org/en/latest/
next prev parent reply other threads:[~2026-11-26 10:55 UTC|newest]
Thread overview: 5+ 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 [this message]
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=87y0afuajd.fsf@t14s.mail-host-address-is-not-set \
--to=a.hindborg@kernel.org \
--cc=7enlab@gmail.com \
--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=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®