gen_pool_dma_zalloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– gen_pool_dma_zalloc β€” from the Kernel API Manual πŸŽ€

okay bestie, so this one lives in the Kernel API Manual and honestly? it's a whole vibe. like, it's the girl who hands you pre-zeroed memory straight out of a pool, DMA-ready, no cap. let's get into it ✨


✨ NAME ✨

gen_pool_dma_zalloc β€” allocate special zeroed memory from the pool for DMA usage πŸ’… literally that's the whole gig.


🌸 SYNOPSIS 🌸

void * gen_pool_dma_zalloc (struct gen_pool *pool , size_t size ,
       dma_addr_t *dma );

look at her. three args, returns a void *. iconic signature, no notes 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • pool β€” the pool you're allocating from, bestie. your source of truth πŸ’–
  • size β€” how many bytes you want from the pool. like, exactly this many, don't be weird about it ✨
  • dma β€” the dma-view physical address, returned to you as a return value. pass NULL if you literally don't need it β€” she won't be offended πŸ™ˆ

🧚 DESCRIPTION 🧚

so here's the tea β˜•: this bad girl allocates the requested number of zeroed bytes from the specified pool. zeroed! as in, already clean, already fresh out the box, you don't gotta memset anything. main character energy fr fr πŸ‘‘

she uses the pool allocation function β€” with first-fit algorithm by default β€” so yep, she's out here finding the first chunk that fits. classic.

⚠️ real talk tho: this can not be used in NMI handler on architectures without NMI-safe cmpxchg implementation. like, that's not a suggestion, that's a hard no. don't do it, i'm begging πŸ˜­πŸ’€

⭐ RETURN ⭐

she gives you the virtual address of the allocated zeroed memory πŸ’–

or NULL on failure πŸ₯Ί (it happens, we don't judge)


πŸŽ€ SEE ALSO πŸŽ€

the whole friend group is in the kernel file ./lib/genalloc.c β€” go say hi to all of them 🫢✨


and that's the whole page, bestie! πŸ’œ this cutie came out of ./lib in October 2026, and she's filed under gen_pool_dma_zalloc(9) β€” go forth and allocate responsibly, mwah πŸ’‹πŸŒ·

πŸ“¦ where this page comes from