dma_alloc_contiguous(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 πŸ¦‹

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