]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rust: alloc: implement `Allocator` for `Kmalloc`
authorDanilo Krummrich <dakr@kernel.org>
Fri, 7 Mar 2025 22:49:32 +0000 (23:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:01:44 +0000 (13:01 +0100)
commitdcaf3206d942f2ebf497ec96f85f15beb21d55c8
tree66bfb4da7e9cc01c7cc4fe44a8fa802331e413d1
parent594134eb9cb57a2fff4911a508dab1fa2e8a6d53
rust: alloc: implement `Allocator` for `Kmalloc`

commit a34822d1c4c93085f635b922441a017bd7e959b0 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
rust/kernel/alloc/allocator.rs