kmem_cache_alloc_bulk(9)
π kmem_cache_alloc_bulk π
okay so bestie, welcome to the Kernel API Manual β this one is kmem_cache_alloc_bulk(9), and it's literally the "grab a whole squad of objects at once" function. no cap. π
β¨ SYNOPSIS β¨
bool kmem_cache_alloc_bulk (struct kmem_cache *s , gfp_t flags , size_t
size , void **p );
that's the whole vibe. it hands you back a bool, so you already know this is a yes-or-no situation π¦
πΈ ARGUMENTS πΈ
sβ the cache you're allocating from. your source, your supply, your main character cache πflagsβ theGFP_*flags. seekmalloc. that's where they live, go look π«Άsizeβ how many objects you want. the number of besties you're inviting πpβ the array where the allocated objects land. your little parking lot for pointers π
π DESCRIPTION π
so basically: this allocates size objects out of s and drops them into p. super straightforward, we love a function that does what it says.
β οΈ important: size must be larger than 0. like, zero is not a vibe here, it's invalid. periodt.
also interrupts must be enabled when you call this function. yes, that's a real requirement, don't come for me π
and here's the fun part β unlike alloc_pages_bulk, this function does not check for already allocated objects in p. so the caller does not need to zero it out first. convenient? yes. also lowkey means you'd better know what you're doing with p π
π₯ RETURN π₯
trueβ the allocation succeeded, slay β¨falseβ it failed, and we don't talk about it π
π§ SEE ALSO π§
kernel file ./mm/slub.c, plus the whole extended friend group:
enum slab_flags(9)kmem_cache_alloc_node(9)kmem_cache_free(9)ksize(9)kfree(9)kvfree(9)kvfree_atomic(9)kvfree_sensitive(9)
go read them, iykyk πβπ
kisses, this page came to you from ./mm, dated October 2026, and it's kmem_cache_alloc_bulk(9) signing off β bye bestie, go allocate responsibly ππ¦πΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms