dma_alloc_contiguous(9)
π dma_alloc_contiguous(9) π
okay bestie, so this is dma_alloc_contiguous(9) straight out of the Kernel API Manual β it's the function that scores you some contiguous pages and honestly? it's kind of the main character of ./kernel/dma. let's get into it π«Ά
β¨ SYNOPSIS β¨
struct page * dma_alloc_contiguous (struct device *dev , size_t size ,
gfp_t gfp );
like, that's the whole vibe. it hands you back a struct page *, periodt. π
π ARGUMENTS π
devβ pointer to the device you're doing this allocation for, iykyk β it's their allocation, not yours πsizeβ the requested allocation size. yeah. how much you want. πgfpβ the allocation flags. the little knobs that tell the allocator how to behave β¨
πΈ DESCRIPTION πΈ
so here's the tea β β it tries to use the device specific contiguous memory area if one is available. and if that's not it, it tries the per-numa cma. and if the allocation fails? no worries bestie, it will fallback to try the default global one. three-tier slay. π₯
also important, fr fr: it bypasses one-page size of allocations from the per-numa and global area. why? because the addresses within one page are always contiguous, so there's literally no need to waste CMA pages for that kind of thing π§ and lowkey it also helps reduce fragmentations. we love an efficient icon. π
π¦ SEE ALSO π¦
- Kernel file
./kernel/dma/contiguous.c dma_contiguous_get_area_by_idx(9)dma_contiguous_reserve(9)dma_contiguous_reserve_area(9)dma_alloc_from_contiguous(9)dma_release_from_contiguous(9)dma_free_contiguous(9)
like, go read the whole friend group, they're all connected π
and that's the page!! π brought to you from ./kernel/dma, dated October 2026, and yeah β this is dma_alloc_contiguous(9) signing off. 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