rust: alloc: Add realloc and alloc_zeroed to the GlobalAlloc impl
authorBjörn Roy Baron <bjorn3_gh@protonmail.com>
Sun, 30 Jul 2023 01:29:04 +0000 (18:29 -0700)
committerMiguel Ojeda <ojeda@kernel.org>
Mon, 7 Aug 2023 09:33:34 +0000 (11:33 +0200)
commit0beaf546b4f198dd767b5a01a73f24db269ff6e2
tree3e2140a0f3fbe42b45a981150736c8ea8b578508
parentf39a97d0d8a765268b8de17f2e34393e7cb2cd2d
rust: alloc: Add realloc and alloc_zeroed to the GlobalAlloc impl

While there are default impls for these methods, using the respective C
api's is faster. Currently neither the existing nor these new
GlobalAlloc method implementations are actually called. Instead the
__rust_* function defined below the GlobalAlloc impl are used. With
rustc 1.71 these functions will be gone and all allocation calls will go
through the GlobalAlloc implementation.

Link: https://github.com/Rust-for-Linux/linux/issues/68
Signed-off-by: Björn Roy Baron <bjorn3_gh@protonmail.com>
[boqun: add size adjustment for alignment requirement]
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com>
Link: https://lore.kernel.org/r/20230730012905.643822-4-boqun.feng@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/allocator.rs