mempool_alloc_bulk(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– mempool_alloc_bulk(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual ✨ β€” this one's all about mempool_alloc_bulk, and it's lowkey a vibe. it grabs a whole handful of elements out of a memory pool for you, no cap. 🫢


✨ NAME ✨

mempool_alloc_bulk β€” allocate multiple elements from a memory pool πŸŽ€


🌸 SYNOPSIS 🌸

int mempool_alloc_bulk (struct mempool *pool , void **elems , unsigned int count );

like, that's the whole signature, she's right there πŸ‘‘


πŸ¦‹ ARGUMENTS πŸ¦‹

  • pool β€” pointer to the memory pool πŸ’§ that's your pool, your main character
  • elems β€” a partially or fully populated elements array πŸ“¦ it can show up half-full or fully stacked, either way she's valid
  • count β€” the number of entries in elem that need to be allocated πŸ”’ yes bestie, literally how many slots we're filling

🌈 DESCRIPTION 🌈

so here's the tea β˜• β€” this bad boy allocates count elements into elems.

the way it works is: first it calls into the alloc_fn that you supplied back at pool initialization time ✨, and then, when alloc_fn fails to allocate an element (rude of it honestly 😭), it dips into the reserved pool instead. like a backup bestie. πŸ’…

on return, all count elements in elems will be populated πŸŽ‰ every single one. fully seated. no empty chairs at this table. πŸ”₯


⭐ RETURN ⭐

always 0. that's it. that's the whole return value. 🫢

fun fact: if it wasn't for %$#^$ alloc tags, it would return void. instead it returns 0 and we all just live with that πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./mm/mempool.c β€” go read her, she's iconic πŸ“–


okay and finally, the cute lil sign-off πŸŽ€ this whole page lives in ./mm, it's dated October 2026, and yes β€” mempool_alloc_bulk(9) is the title, she's in the 9 section, periodt. πŸ’œβœ¨πŸ§š

πŸ“¦ where this page comes from