dma_get_seg...ary_nr_pages(9)
π dma_get_seg...ary_nr_pages(9) π
okay so bestie, we're in the Kernel API Manual today and the star of the show is dma_get_seg...ary_nr_pages(9) (the full name got cut off in the header bc it's long, we'll get to it, don't worry π«Ά). it's giving "small function, big responsibility" and honestly? iconic. let's get into it β¨
πΈ NAME πΈ
dma_get_seg_boundary_nr_pages β returns the segment boundary in "page" units, no cap π
β¨ SYNOPSIS β¨
unsigned long dma_get_seg_boundary_nr_pages (struct device *dev ,
unsigned int page_shift );
literally just two args. we love a low-maintenance signature π
π¦ ARGUMENTS π¦
devβ the device you're querying the boundary for, iykyk πpage_shiftβ theilogof the IOMMU page size. yes, that's what it says, that's the vibe β
π DESCRIPTION π
okay so what it actually does: it returns the segment boundary in IOMMU page units for the device you passed in. and heads up β those IOMMU page units may be different from the CPU page size, so don't go assuming they're the same, that's the whole plot twist π₯
ifdevisNULL, a boundary ofU32_MAXis assumed. and the docs are clear about why: this case is just for non-DMA API callers. so like, not your average DMA situation, bestie π
π§ SEE ALSO π§
- Kernel file
./include/linux/dma-mapping.hπ dma_use_iova(9)dma_unmap_sgtable(9)dma_sync_sgtable_for_cpu(9)dma_sync_sgtable_for_device(9)
go read those next, they're all in the same friend group fr fr π
that's the whole page, periodt πβ¨ this little legend lives over in ./include/linux and the page is dated October 2026 β mwah, go query some boundaries responsibly, love u bye πππΈ
π¦ 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