Skip to content

implement `kernel::sync::Refcount` and convert users

Gary Guo linux-block lkml rust-for-linux 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 15 repliesIn review
  2. v23 patches 6 repliesSuperseded
  3. v13 patches 33 repliesSuperseded

Changes in v3 from the cover letter

- Drop dec_not_one and revert to dec_and_test/set as the former
lacks acquire semantics.
- Move a use statement from patch 1 to correct place (patch 3).
- Update maintainer entry to include refcount.rs and add myself as a
reviewer, as suggested by Boqun.
- Link to v2: https://lore.kernel.org/rust-for-linux/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4rust: implement `kernel::sync::Refcount`rust/helpers/refcount.c rust/kernel/sync.rs rust/kernel/sync/refcount.rs+98 -04 replies
2/4rust: convert `Arc` to use `Refcount`rust/kernel/sync/arc.rs+26 -396 replies
3/4rust: block: convert `block::mq` to use `Refcount`rust/kernel/block/mq/operations.rs rust/kernel/block/mq/request.rs rust/kernel/sync/refcount.rs+40 -514 replies
4/4MAINTAINERS: update atomic infrastructure entry to include RustMAINTAINERS+2 -01 reply

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchAlice RyhlBoqun FengAndreas HindborgDavid GowFiona Behrens
1/4R-b R-b R-b
2/4
3/4A-b T-b
4/4A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/4] implement `kernel::sync::Refcount` and convert users

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.

Changes in v3:
- Drop dec_not_one and revert to dec_and_test/set as the former
lacks acquire semantics.
- Move a use statement from patch 1 to correct place (patch 3).
- Update maintainer entry to include refcount.rs and add myself as a
reviewer, as suggested by Boqun.
- Link to v2: https://lore.kernel.org/rust-for-linux/[email protected]

Changes in v2:
- Refcount::read method is dropped
- Refcount::dec_not_one method is added and Arc::into_unique_or_drop
is converted to use it.
- Link to v1: https://lore.kernel.org/rust-for-linux/[email protected]

Gary Guo (4):
rust: implement kernel::sync::Refcount
rust: convert Arc to use Refcount
rust: block: convert block::mq to use Refcount
MAINTAINERS: update atomic infrastructure entry to include Rust

 MAINTAINERS                        |   2 +
 rust/helpers/refcount.c            |  10 +++
 rust/kernel/block/mq/operations.rs |   7 +-
 rust/kernel/block/mq/request.rs    |  70 +++++++-------------
 rust/kernel/sync.rs                |   2 +
 rust/kernel/sync/arc.rs            |  65 ++++++++-----------
 rust/kernel/sync/refcount.rs       | 100 +++++++++++++++++++++++++++++
 7 files changed, 166 insertions(+), 90 deletions(-)
 create mode 100644 rust/kernel/sync/refcount.rs

base-commit: beeb78d46249cab8b2b8359a2ce8fa5376b5ad2d

Signature · 1 line
2.47.2