mempool_resize(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 via mempool_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 ⭐

  • 0 on 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 of mempool_resize(9). go resize a pool responsibly, bestie. mwah πŸ’œπŸ§š
πŸ“¦ where this page comes from