mempool_resize(9)
π mempool_resize(9) β the Kernel API Manual moment
ok so first things first: this page is mempool_resize(9) from the Kernel API Manual, and it's literally the glow-up guide for your memory pool. bestie, let's get into it β¨
πΈ NAME πΈ
mempool_resize β resize an existing memory pool
like, you already have a pool and now you're changing its shape. it's giving tailor energy π
β¨ SYNOPSIS β¨
int mempool_resize (struct mempool *pool , int new_min_nr );
that's it. that's the whole vibe check. π
π«Ά ARGUMENTS π«Ά
poolβ pointer to the memory pool which was allocated viamempool_create. yep, it's gotta be one of those pools, not some random struct you found on the floor πnew_min_nrβ the new minimum number of elements guaranteed to be allocated for this pool. this is the new floor, the new bare minimum, the new "at least this many or we riot" number π
π« DESCRIPTION π«
bestie, this function shrinks/grows the pool. both directions. versatile icon behavior.
In the case of growing, it cannot be guaranteed that the pool will be grown to the new size immediately, but new mempool_free calls will refill it. so like, if you're growing β no cap, sometimes it's not instant, the frees do the heavy lifting later. patience, queen π¦
β οΈ This function may sleep. it's a nap-allowed function. do NOT call it from a context where sleeping is forbidden, iykyk π
Note, the caller must guarantee that no mempool_destroy is called while this function is running. like, do not destroy the pool mid-resize. that's chaotic evil and we're not doing that π
mempool_alloc & mempool_free might be called (eg. from IRQ contexts) while this function executes. so yeah β allocs and frees can be happening while you're resizing, and that's fine and expected. main character concurrency energy π
β RETURN β
0on success β slay, we ate β¨- negative error code otherwise β not slay, something went sideways π
π SEE ALSO π
Kernel file ./mm/mempool.c, plus the whole friend group:
mempool_exit(9), mempool_destroy(9), mempool_init(9), mempool_create_node(9), mempool_alloc_bulk(9), mempool_alloc(9), mempool_alloc_preallocated(9), mempool_free_bulk(9), mempool_free(9)
π«Ά and that's the page! brought to you by the fine folks over at./mmβ this one's dated October 2026 and yes, it's part ofmempool_resize(9). go resize a pool responsibly, bestie. mwah ππ§
π¦ 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