implement `kernel::sync::Refcount` and convert users
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest5 patches 13 repliesIn review
- v45 patches 4 repliesSuperseded
Changes in v5 from the cover letter
- Forbid using Refcount::new() with already-saturated initial value. (Refcount::set can still set value to the saturated range, as
users may want to set it to a runtime value that the compiler cannot
easily determine to be non-negative).
- Moved a documentation comment from one commit to another following
Benno's suggestion
- Link to v4: https://lore.kernel.org/rust-for-linux/[email protected]/
Patches in v5 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | rust: implement `kernel::sync::Refcount`rust/ rust/ rust/ | +110 | 4 replies | |
| 2/5 | rust: make `Arc::into_unique_or_drop` associated functionrust/ | +6 | 1 reply | |
| 3/5 | rust: convert `Arc` to use `Refcount`rust/ | +14 | 2 replies | |
| 4/5 | rust: block: convert `block::mq` to use `Refcount`rust/ rust/ rust/ | +34 | 6 replies | |
| 5/5 | MAINTAINERS: update atomic infrastructure entry to include RustMAINTAINERS | +2 | 0 replies |
Reviews trailers per patch
All 5 patches have a Reviewed-by or Acked-by.
| Patch | Alice Ryhl | Boqun Feng | Fiona Behrens | Benno Lossin | David Gow | Andreas Hindborg | Alexandre Courbot |
|---|---|---|---|---|---|---|---|
| 1/5 | R-b | R-b | R-b | R-b | |||
| 2/5 | R-b | R-b | |||||
| 3/5 | R-b | R-b | |||||
| 4/5 | R-b | T-b | A-b | ||||
| 5/5 | A-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 7 reviewers.
Cover letter [PATCH v5 0/5] implement `kernel::sync::Refcount` and convert users
From: Gary Guo <[email protected]>
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 v5:
- Forbid using Refcount::new() with already-saturated initial value. (Refcount::set can still set value to the saturated range, as
users may want to set it to a runtime value that the compiler cannot
easily determine to be non-negative).
- Moved a documentation comment from one commit to another following
Benno's suggestion
- Link to v4: https://lore.kernel.org/rust-for-linux/[email protected]/
Changes in v4:
- Move justification on why &Refcount is okay when used for reference
coutning into the Refcount::dec_and_test documentation comment.
- Split Arc::into_unique_or_drop signature change into another patch.
- Wording/comment changes
- Link to v3: https://lore.kernel.org/rust-for-linux/[email protected]/
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 (5):
rust: implement kernel::sync::Refcount
rust: make Arc::into_unique_or_drop associated function
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 | 63 +++++----------- rust/kernel/sync.rs | 2 + rust/kernel/sync/arc.rs | 55 +++++--------- rust/kernel/sync/refcount.rs | 112 +++++++++++++++++++++++++++++ 7 files changed, 165 insertions(+), 86 deletions(-) create mode 100644 rust/kernel/sync/refcount.rs
base-commit: cc84ef3b88f407e8bd5a5f7b6906d1e69851c856
Signature · 1 line
2.49.0