gen_pool_dma_alloc_align(9)
π« gen_pool_dma_alloc_align β bestie edition π«
okay so this is from the Kernel API Manual and it's literally the glow-up guide for gen_pool_dma_alloc_align. it's giving "allocate special memory from the pool for DMA usage with the given alignment" and honestly? iconic.
π οΈ SYNOPSIS π οΈ
void * gen_pool_dma_alloc_align (struct gen_pool *pool , size_t size ,
dma_addr_t *dma , int align );
π ARGUMENTS π
poolβ the pool you're allocating from, bestie. that's your source.sizeβ number of bytes to allocate from the pool. yes, the exact byte count, no cap.dmaβ the DMA-view physical address return value. useNULLif unneeded β like, if you don't care about the physical address, just passNULLand move on.alignβ alignment in bytes for the starting address. it's giving "make it line up precisely" energy.
β¨ DESCRIPTION β¨
so what this does is allocate the requested number of bytes from the specified pool, with the given alignment restriction. like, you get your memory, and it starts at an address that's aligned the way you asked. slay.
β οΈ real talk though: this can not be used in an NMI handler on architectures without an NMI-safe cmpxchg implementation. periodt. don't try it there, it's not gonna work and that's not a vibe.
π RETURN π
on success, you get the virtual address of the allocated memory. on failure? you get NULL. that's it. that's the whole mood. π
π SEE ALSO π
kernel file ./lib/genalloc.c and the whole squad:
gen_pool_create(9), gen_pool_add_owner(9), gen_pool_virt_to_phys(9), gen_pool_destroy(9), gen_pool_alloc_algo_owner(9), gen_pool_dma_alloc(9), gen_pool_dma_alloc_algo(9), gen_pool_dma_zalloc(9), gen_pool_dma_zalloc_algo(9), gen_pool_dma_zalloc_align(9), gen_pool_free_owner(9), gen_pool_for_each_chunk(9), gen_pool_has_addr(9), gen_pool_avail(9), gen_pool_size(9), gen_pool_set_algo(9), gen_pool_first_fit(9), gen_pool_first_fit_align(9), gen_pool_fixed_alloc(9), gen_pool_first_fit_order_align(9), gen_pool_best_fit(9), gen_pool_get(9), devm_gen_pool_create(9), of_gen_pool_get(9).
that's the whole page, bestie. now go allocate something aligned and live your main character kernel-dev life π π¦
signed, sealed, delivered by the kernel gang from ./lib β October 2026, version gen_pool_dma_alloc_align(9) π
π¦ 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