From: Gary Guo <gary@garyguo.net>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>
Cc: Will Deacon <will@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Mark Rutland <mark.rutland@arm.com>,
rust-for-linux@vger.kernel.org
Subject: [PATCH 0/3] implement `kernel::sync::Refcount` and convert users
Date: Fri, 4 Oct 2024 16:52:21 +0100 [thread overview]
Message-ID: <20241004155247.2210469-1-gary@garyguo.net> (raw)
Currently there're two refcount usage in rust/, `Arc` and `block::mq`.
`Arc` uses `refcount_t` with FFI calls directly, and `block::mq` use
Rust atomics and custom refcounting.
This series consolidate them to have a single `Refcount` which wraps
`refcount_t` and have it used by both.
With the removal of Rust `AtomicU64` this would also make the code work
for 32-bit systems. See [1] as a previous attempt to fix this issue.
Cc: Will Deacon <will@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/rust-for-linux/20240905061214.3954271-1-davidgow@google.com/ [1]
Gary Guo (3):
rust: implement `kernel::sync::Refcount`
rust: convert `Arc` to use `Refcount`
rust: block: convert `block::mq` to use `Refcount`
rust/helpers/refcount.c | 15 ++++
rust/kernel/block/mq/operations.rs | 7 +-
rust/kernel/block/mq/request.rs | 70 ++++++-------------
rust/kernel/sync.rs | 2 +
rust/kernel/sync/arc.rs | 45 ++++++------
rust/kernel/sync/refcount.rs | 106 +++++++++++++++++++++++++++++
6 files changed, 168 insertions(+), 77 deletions(-)
create mode 100644 rust/kernel/sync/refcount.rs
base-commit: c94d8cdb9ade6357824d6c2338e03d1cc726d43a
--
2.44.1
next reply other threads:[~2024-10-04 15:53 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 15:52 Gary Guo [this message]
2024-10-04 15:52 ` [PATCH 1/3] rust: implement `kernel::sync::Refcount` Gary Guo
2024-10-04 16:34 ` Dirk Behme
2024-10-04 18:51 ` Andreas Hindborg
2024-10-04 19:08 ` Gary Guo
2024-10-04 19:22 ` Andreas Hindborg
2024-10-05 6:04 ` Dirk Behme
2024-10-05 7:40 ` Greg KH
2024-10-05 13:31 ` Gary Guo
2024-10-05 14:26 ` Gary Guo
2024-10-07 12:30 ` Alice Ryhl
2024-10-04 15:52 ` [PATCH 2/3] rust: convert `Arc` to use `Refcount` Gary Guo
2024-10-05 12:06 ` Alice Ryhl
2024-10-05 13:12 ` Gary Guo
2024-10-04 15:52 ` [PATCH 3/3] rust: block: convert `block::mq` " Gary Guo
2024-10-04 16:43 ` Dirk Behme
2024-10-04 18:05 ` Andreas Hindborg
2024-10-05 15:08 ` Gary Guo
2024-10-05 18:47 ` Andreas Hindborg
2024-10-04 18:34 ` Andreas Hindborg
2024-10-04 18:43 ` Gary Guo
2024-10-04 19:18 ` Andreas Hindborg
2024-10-05 7:47 ` Greg KH
2024-10-05 9:48 ` Andreas Hindborg
2024-10-05 10:09 ` Greg KH
2024-10-05 10:10 ` Peter Zijlstra
2024-10-05 10:57 ` Andreas Hindborg
2024-10-05 11:05 ` Miguel Ojeda
2024-10-05 11:59 ` Alice Ryhl
2024-10-05 13:23 ` Gary Guo
2024-10-05 14:56 ` Andreas Hindborg
2024-10-10 8:39 ` Andreas Hindborg
2024-10-10 9:06 ` Andreas Hindborg
2024-10-10 9:48 ` Benno Lossin
2024-10-10 11:13 ` Andreas Hindborg
2024-10-05 14:51 ` Andreas Hindborg
2024-10-10 8:41 ` 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=20241004155247.2210469-1-gary@garyguo.net \
--to=gary@garyguo.net \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=mark.rutland@arm.com \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=will@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).