mempool_create_node(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– mempool_create_node(9) πŸ’–

so this is a page from the Kernel API Manual, bestie β€” it's mempool_create_node, and it's literally the glow-up version of "make me a memory pool, but on this specific NUMA node." let's get into it ✨


🌸 NAME 🌸

mempool_create_node β€” create a memory pool 🫢


πŸŽ€ SYNOPSIS πŸŽ€

struct mempool * mempool_create_node (int min_nr , mempool_alloc_t
*alloc_fn , mempool_free_t *free_fn , void *pool_data , gfp_t gfp_mask ,
int node_id );

like, six args, no cap. keep them exactly like that πŸ’…


✨ ARGUMENTS ✨

  • min_nr β€” the minimum number of elements that are guaranteed to be allocated for this pool. it's the floor, the bare minimum, the "at least this many, periodt" πŸ’–
  • alloc_fn β€” your very own user-defined element-allocation function. you bring the function, the kernel brings the vibes πŸ”₯
  • free_fn β€” your very own user-defined element-freeing function. the matching pair to alloc_fn, iykyk πŸ¦‹
  • pool_data β€” optional private data that gets handed to your user-defined functions. optional! but like, sometimes you need it 🌸
  • gfp_mask β€” the memory allocation flags. the whole personality of the allocation, honestly ⭐
  • node_id β€” the numa node to allocate on. location, location, location πŸ‘‘

🧚 DESCRIPTION 🧚

okay so this function creates and allocates a guaranteed-size, preallocated memory pool. yes β€” guaranteed size, already preallocated, no surprises πŸ’… the pool is then usable from the mempool_alloc and mempool_free functions.

important vibe check: this function might sleep. 😴 and it's not just her β€” both alloc_fn and free_fn might sleep too, and that's fine, as long as the mempool_alloc function is not called from IRQ contexts. so like, IRQ context? not the moment, bestie πŸ™ˆ


🌈 RETURN 🌈

a pointer to the created memory pool object β€” or NULL on error. so like, always check, fr fr 😭


πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, bestie πŸŽ€ this one lives in ./mm, dated October 2026, under the mempool_create_node(9) title β€” iconic, no notes πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from