]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: alloc: implement Box::pin_slice()
authorAlice Ryhl <aliceryhl@google.com>
Mon, 11 Aug 2025 10:14:56 +0000 (12:14 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Thu, 21 Aug 2025 14:42:49 +0000 (16:42 +0200)
commitac9eea3d08c25fb213deb113d246ff5dadb31fbc
tree4df2bf1e33db099eeb7e3f33c747a7b6ec96698a
parent8efe8816a7ddc98a733ca3326ae8794750bbbd34
rust: alloc: implement Box::pin_slice()

Add a new constructor to Box to facilitate Box creation from a pinned
slice of elements. This allows to efficiently allocate memory for e.g.
slices of structrures containing spinlocks or mutexes. Such slices may
be used in kmemcache like or zpool API implementations.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.se>
Link: https://lore.kernel.org/r/20250811101456.2901694-1-vitaly.wool@konsulko.se
[ Add empty lines after struct definitions in the example; end sentences
  with a period. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/alloc/kbox.rs