rust: alloc: implement `Allocator` for `Kmalloc`
authorDanilo Krummrich <dakr@kernel.org>
Fri, 4 Oct 2024 15:41:10 +0000 (17:41 +0200)
committerMiguel Ojeda <ojeda@kernel.org>
Tue, 15 Oct 2024 20:56:59 +0000 (22:56 +0200)
commita34822d1c4c93085f635b922441a017bd7e959b0
treee1dcdc55e38adb0375cd827d11028f95954e79b4
parenta87a36f0bf517dae22f3e3790b05c979070f776a
rust: alloc: implement `Allocator` for `Kmalloc`

Implement `Allocator` for `Kmalloc`, the kernel's default allocator,
typically used for objects smaller than page size.

All memory allocations made with `Kmalloc` end up in `krealloc()`.

It serves as allocator for the subsequently introduced types `KBox` and
`KVec`.

Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20241004154149.93856-7-dakr@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/alloc/allocator.rs