gen_pool_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

gen_pool_alloc β€” allocate special memory from the pool, bestie ✨

So yeah, this is the Kernel API Manual entry for our girl gen_pool_alloc(9), and she's literally the one you call when you need to pull special memory out of a pool 🫢


🌸 SYNOPSIS 🌸

unsigned long gen_pool_alloc (struct gen_pool *pool , size_t size );

That's the whole vibe. Two args, one unsigned long coming back at you πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • pool β€” the pool you're allocating from, iykyk πŸŠβ€β™€οΈ
  • size β€” the number of bytes you want allocated out of the pool, fr fr

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so here's the tea β˜•: gen_pool_alloc allocates the requested number of bytes from the specified pool. That's it, that's the job, and she ate πŸ”₯

It uses the pool allocation function β€” with the first-fit algorithm by default β€” which is a whole thing you should know about before you go poking at pool internals πŸ‘€

⚠️ Important caveat, no cap: this function can not be used in an NMI handler on architectures without an NMI-safe cmpxchg implementation. Like, literally cannot. Don't try it, bestie, that's not the moment for main character energy πŸ˜­πŸ’€

🌈 SEE ALSO 🌈

  • Kernel file ./include/linux/genalloc.h and genpool_algo_t(9) β€” go read these, they're iconic πŸ‘‘
  • gen_pool_add(9) β€” the sibling function, she's also slaying

And that's a wrap, bestie! This little gem lives over in ./include/linux β€” the October 2026 edition, mwah πŸ’‹πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from