[PATCH v2 7/9] slab: Introduce kmem_buckets_valloc()

From: Kees Cook
Date: Tue Mar 05 2024 - 05:11:47 EST


For allocations that may need to fallback to vmalloc, add
kmem_buckets_valloc().

Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
---
Cc: Vlastimil Babka <vbabka@xxxxxxx>
Cc: Christoph Lameter <cl@xxxxxxxxx>
Cc: Pekka Enberg <penberg@xxxxxxxxxx>
Cc: David Rientjes <rientjes@xxxxxxxxxx>
Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Roman Gushchin <roman.gushchin@xxxxxxxxx>
Cc: Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>
Cc: linux-mm@xxxxxxxxx
---
include/linux/slab.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 7d84f875dcf4..0cf72861d5fa 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -740,6 +740,12 @@ static inline __alloc_size(1) void *kzalloc_node(size_t size, gfp_t flags, int n
void * __alloc_size(2)
__kvmalloc_node(kmem_buckets *b, size_t size, gfp_t flags, int node);

+static __always_inline __alloc_size(2)
+void *kmem_buckets_valloc(kmem_buckets *b, size_t size, gfp_t flags)
+{
+ return __kvmalloc_node(b, size, flags, NUMA_NO_NODE);
+}
+
static inline __alloc_size(1) void *kvmalloc_node(size_t size, gfp_t flags, int node)
{
return __kvmalloc_node(NULL, size, flags, node);
--
2.34.1