summaryrefslogtreecommitdiff
path: root/tools/include/linux/slab.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2026-03-26 02:41:26 +0300
committerDave Airlie <airlied@redhat.com>2026-03-26 02:41:26 +0300
commit13c072b8e91a5ccb5855ca1ba6fe3ea467dbf94d (patch)
tree4f69505f13121244c22013245534caa2d1b04b52 /tools/include/linux/slab.h
parent74919e2797727596816a06e55c35352e0707a710 (diff)
parentf338e77383789c0cae23ca3d48adcc5e9e137e3c (diff)
downloadlinux-13c072b8e91a5ccb5855ca1ba6fe3ea467dbf94d.tar.xz
BackMerge tag 'v7.0-rc4' into drm-next
Linux 7.0-rc4 Needed for rust tree. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'tools/include/linux/slab.h')
-rw-r--r--tools/include/linux/slab.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/include/linux/slab.h b/tools/include/linux/slab.h
index 94937a699402..6d8e9413d5a4 100644
--- a/tools/include/linux/slab.h
+++ b/tools/include/linux/slab.h
@@ -202,4 +202,13 @@ static inline unsigned int kmem_cache_sheaf_size(struct slab_sheaf *sheaf)
return sheaf->size;
}
+#define __alloc_objs(KMALLOC, GFP, TYPE, COUNT) \
+({ \
+ const size_t __obj_size = size_mul(sizeof(TYPE), COUNT); \
+ (TYPE *)KMALLOC(__obj_size, GFP); \
+})
+
+#define kzalloc_obj(P, ...) \
+ __alloc_objs(kzalloc, default_gfp(__VA_ARGS__), typeof(P), 1)
+
#endif /* _TOOLS_SLAB_H */