rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] Allocation APIs
@ 2024-03-25 19:54 Wedson Almeida Filho
  2024-03-25 19:54 ` [PATCH 01/10] rust: kernel: move `allocator` module under `alloc` Wedson Almeida Filho
                   ` (9 more replies)
  0 siblings, 10 replies; 30+ messages in thread
From: Wedson Almeida Filho @ 2024-03-25 19:54 UTC (permalink / raw)
  To: rust-for-linux
  Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	linux-kernel, Wedson Almeida Filho

From: Wedson Almeida Filho <walmeida@microsoft.com>

Revamp how we use the `alloc` crate.

We currently have a fork of the crate with changes to `Vec`; other
changes have been upstreamed (to the Rust project). This series removes
the fork and exposes all the functionality as extension traits.

Additionally, it also introduces allocation flag parameters to all
functions that may result in allocations (e.g., `Box::new`, `Arc::new`,
`Vec::push`, etc.) without the `try_` prefix -- the names are available
because we build `alloc` with `no_global_oom_handling`.

Lastly, the series also removes our reliance on the `allocator_api`
unstable feature.

Long term, we still want to make such functionality available in
upstream Rust, but this allows us to make progress now and reduces our
maintainance burden.

In summary:
1. Removes `alloc` fork
2. Removes use of `allocator_api` unstable feature
3. Introduces flags (e.g., GFP_KERNEL, GFP_ATOMIC) when allocating

Wedson Almeida Filho (10):
  rust: kernel: move `allocator` module under `alloc`
  rust: alloc: introduce the `VecExt` trait
  kbuild: use the upstream `alloc` crate
  rust: alloc: remove our fork of the `alloc` crate
  rust: alloc: introduce allocation flags
  rust: alloc: introduce the `BoxExt` trait
  rust: alloc: update `VecExt` to take allocation flags
  rust: sync: update `Arc` and `UniqueArc` to take allocation flags
  rust: init: update `init` module to take allocation flags
  rust: kernel: remove usage of `allocator_api` unstable feature

 rust/Makefile                        |   16 +-
 rust/alloc/README.md                 |   36 -
 rust/alloc/alloc.rs                  |  452 ----
 rust/alloc/boxed.rs                  | 2463 -----------------
 rust/alloc/collections/mod.rs        |  160 --
 rust/alloc/lib.rs                    |  288 --
 rust/alloc/raw_vec.rs                |  611 -----
 rust/alloc/slice.rs                  |  890 -------
 rust/alloc/vec/drain.rs              |  255 --
 rust/alloc/vec/extract_if.rs         |  115 -
 rust/alloc/vec/into_iter.rs          |  454 ----
 rust/alloc/vec/is_zero.rs            |  204 --
 rust/alloc/vec/mod.rs                | 3683 --------------------------
 rust/alloc/vec/partial_eq.rs         |   49 -
 rust/alloc/vec/set_len_on_drop.rs    |   35 -
 rust/alloc/vec/spec_extend.rs        |  119 -
 rust/bindings/bindings_helper.h      |    3 +
 rust/kernel/alloc.rs                 |   68 +
 rust/kernel/{ => alloc}/allocator.rs |    6 +-
 rust/kernel/alloc/boxext.rs          |   60 +
 rust/kernel/alloc/vecext.rs          |  120 +
 rust/kernel/error.rs                 |   13 +-
 rust/kernel/init.rs                  |   57 +-
 rust/kernel/lib.rs                   |    5 +-
 rust/kernel/prelude.rs               |    2 +
 rust/kernel/str.rs                   |    6 +-
 rust/kernel/sync/arc.rs              |   44 +-
 rust/kernel/sync/condvar.rs          |    2 +-
 rust/kernel/sync/lock/mutex.rs       |    2 +-
 rust/kernel/sync/lock/spinlock.rs    |    2 +-
 rust/kernel/types.rs                 |    4 +-
 rust/kernel/workqueue.rs             |   14 +-
 samples/rust/rust_minimal.rs         |    6 +-
 samples/rust/rust_print.rs           |    4 +-
 scripts/generate_rust_analyzer.py    |    2 +-
 35 files changed, 340 insertions(+), 9910 deletions(-)
 delete mode 100644 rust/alloc/README.md
 delete mode 100644 rust/alloc/alloc.rs
 delete mode 100644 rust/alloc/boxed.rs
 delete mode 100644 rust/alloc/collections/mod.rs
 delete mode 100644 rust/alloc/lib.rs
 delete mode 100644 rust/alloc/raw_vec.rs
 delete mode 100644 rust/alloc/slice.rs
 delete mode 100644 rust/alloc/vec/drain.rs
 delete mode 100644 rust/alloc/vec/extract_if.rs
 delete mode 100644 rust/alloc/vec/into_iter.rs
 delete mode 100644 rust/alloc/vec/is_zero.rs
 delete mode 100644 rust/alloc/vec/mod.rs
 delete mode 100644 rust/alloc/vec/partial_eq.rs
 delete mode 100644 rust/alloc/vec/set_len_on_drop.rs
 delete mode 100644 rust/alloc/vec/spec_extend.rs
 create mode 100644 rust/kernel/alloc.rs
 rename rust/kernel/{ => alloc}/allocator.rs (96%)
 create mode 100644 rust/kernel/alloc/boxext.rs
 create mode 100644 rust/kernel/alloc/vecext.rs


base-commit: 768409cff6cc89fe1194da880537a09857b6e4db
-- 
2.34.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2024-03-27  2:17 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25 19:54 [PATCH 00/10] Allocation APIs Wedson Almeida Filho
2024-03-25 19:54 ` [PATCH 01/10] rust: kernel: move `allocator` module under `alloc` Wedson Almeida Filho
2024-03-25 21:56   ` Benno Lossin
2024-03-26  0:04     ` Wedson Almeida Filho
2024-03-25 19:54 ` [PATCH 02/10] rust: alloc: introduce the `VecExt` trait Wedson Almeida Filho
2024-03-25 22:05   ` Benno Lossin
2024-03-26  0:02     ` Wedson Almeida Filho
2024-03-25 19:54 ` [PATCH 03/10] kbuild: use the upstream `alloc` crate Wedson Almeida Filho
2024-03-25 19:54 ` [PATCH 04/10] rust: alloc: remove our fork of the " Wedson Almeida Filho
2024-03-25 22:24   ` Benno Lossin
2024-03-25 19:54 ` [PATCH 05/10] rust: alloc: introduce allocation flags Wedson Almeida Filho
2024-03-25 22:26   ` Benno Lossin
2024-03-25 19:54 ` [PATCH 06/10] rust: alloc: introduce the `BoxExt` trait Wedson Almeida Filho
2024-03-25 22:37   ` Benno Lossin
2024-03-26  0:17     ` Wedson Almeida Filho
2024-03-26 13:30       ` Benno Lossin
2024-03-27  1:54         ` Wedson Almeida Filho
2024-03-27  1:55         ` Wedson Almeida Filho
2024-03-25 19:54 ` [PATCH 07/10] rust: alloc: update `VecExt` to take allocation flags Wedson Almeida Filho
2024-03-25 20:44   ` Boqun Feng
2024-03-26  0:03     ` Wedson Almeida Filho
2024-03-26 13:58       ` Benno Lossin
2024-03-25 19:54 ` [PATCH 08/10] rust: sync: update `Arc` and `UniqueArc` " Wedson Almeida Filho
2024-03-26 14:01   ` Benno Lossin
2024-03-25 19:54 ` [PATCH 09/10] rust: init: update `init` module " Wedson Almeida Filho
2024-03-26 14:08   ` Benno Lossin
2024-03-27  2:17     ` Wedson Almeida Filho
2024-03-25 19:54 ` [PATCH 10/10] rust: kernel: remove usage of `allocator_api` unstable feature Wedson Almeida Filho
2024-03-26 15:27   ` Benno Lossin
2024-03-27  2:13     ` Wedson Almeida Filho

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).