mempool_create_node(9)
π 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 toalloc_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 π
- the kernel file
./mm/mempool.cβ the source of truth π mempool_exit(9)mempool_destroy(9)mempool_init(9)mempool_resize(9)mempool_alloc_bulk(9)mempool_alloc(9)mempool_alloc_preallocated(9)mempool_free_bulk(9)mempool_free(9)
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
- 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