Skip to content

Draft: Alternative allocator support

Danilo Krummrich rust-for-linux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8rust: alloc: re-enable allocator_apirust/kernel/lib.rs+1 -00 replies
2/8rust: alloc: use AllocError from core::allocrust/kernel/alloc.rs rust/kernel/alloc/box_ext.rs rust/kernel/alloc/vec_ext.rs +5 more+14 -120 replies
3/8rust: alloc: implement AllocatorWithFlags traitrust/kernel/alloc.rs+21 -07 replies
4/8rust: alloc: separate krealloc_aligned()rust/kernel/alloc/allocator.rs+21 -70 replies
5/8rust: alloc: implement AllocatorWithFlags for KernelAllocatorrust/kernel/alloc.rs rust/kernel/alloc/allocator.rs+37 -32 replies
6/8rust: alloc: implement BoxExtAllocrust/kernel/alloc/box_ext.rs+39 -14 replies
7/8rust: alloc: implement VecExtAllocrust/kernel/alloc/vec_ext.rs+84 -10 replies
8/8rust: alloc: implement vmalloc allocatorrust/kernel/alloc/allocator.rs+37 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH WIP 0/8] Draft: Alternative allocator support

DISCLAIMER: This patch series does not raise a claim for inclusion in the kernel (yet) and, instead, serves as a baseline for further discussion.

Hi,

This patch series re-enables the allocator_api and implements an extension trait AllocatorWithFlags expanding the Allocator trait to allow for arbitrary allocator implementations.

It expands Box<T, A> and Vec<T, A> by adding the BoxExtAlloc<T, A> and VecExtAlloc<T, A> traits analogous to the existing BoxExt<T> and VecExt<T> traits and, as an example, implements the VmAllocator (vmalloc).

This patch series is tested (I tested the VecExtAlloc<T, A> parts using my firmware abstractions) and it seems to work quite well. However, since it's just a draft there are no proper commit messages, no documentation and no safety comments.

Also, I'm pretty sure there are some parts of BoxExtAlloc<T, A> and VecExtAlloc<T, A> that, somehow, can be generalized with the existing BoxExt<T> and VecExt<T> implementations.

Please let me know what you think.

- Danilo

Danilo Krummrich (8):
rust: alloc: re-enable allocator_api
rust: alloc: use AllocError from core::alloc
rust: alloc: implement AllocatorWithFlags trait
rust: alloc: separate krealloc_aligned()
rust: alloc: implement AllocatorWithFlags for KernelAllocator
rust: alloc: implement BoxExtAlloc
rust: alloc: implement VecExtAlloc
rust: alloc: implement vmalloc allocator

 rust/kernel/alloc.rs           |  25 ++++++--
 rust/kernel/alloc/allocator.rs | 103 ++++++++++++++++++++++++++++++---
 rust/kernel/alloc/box_ext.rs   |  41 ++++++++++++-
 rust/kernel/alloc/vec_ext.rs   |  86 ++++++++++++++++++++++++++-
 rust/kernel/error.rs           |   3 +-
 rust/kernel/init.rs            |   3 +-
 rust/kernel/lib.rs             |   1 +
 rust/kernel/str.rs             |   3 +-
 rust/kernel/sync/arc.rs        |   4 +-
 rust/kernel/workqueue.rs       |   3 +-
 10 files changed, 251 insertions(+), 21 deletions(-)

base-commit: 2c1092853f163762ef0aabc551a630ef233e1be3

Signature · 1 line
2.44.0