aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/vmalloc.c
diff options
context:
space:
mode:
authorDanilo Krummrich <[email protected]>2024-10-04 15:41:12 +0000
committerMiguel Ojeda <[email protected]>2024-10-15 20:56:59 +0000
commit61c004781d6b928443052e7a6cf84b35d4f61401 (patch)
tree658dcd52aeb70c7bdace12eee020f1acea6682a0 /rust/helpers/vmalloc.c
parentrust: alloc: add module `allocator_test` (diff)
downloadkernel-61c004781d6b928443052e7a6cf84b35d4f61401.tar.gz
kernel-61c004781d6b928443052e7a6cf84b35d4f61401.zip
rust: alloc: implement `Vmalloc` allocator
Implement `Allocator` for `Vmalloc`, the kernel's virtually contiguous allocator, typically used for larger objects, (much) larger than page size. All memory allocations made with `Vmalloc` end up in `vrealloc()`. Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Reviewed-by: Gary Guo <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/helpers/vmalloc.c')
-rw-r--r--rust/helpers/vmalloc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/rust/helpers/vmalloc.c b/rust/helpers/vmalloc.c
new file mode 100644
index 000000000000..80d34501bbc0
--- /dev/null
+++ b/rust/helpers/vmalloc.c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/vmalloc.h>
+
+void * __must_check __realloc_size(2)
+rust_helper_vrealloc(const void *p, size_t size, gfp_t flags)
+{
+ return vrealloc(p, size, flags);
+}