iommu_alloc_pages_node_sz(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ iommu_alloc_pages_node_sz(9) πŸ’œ

okay bestie, welcome to the Kernel API Manual, you're gonna love this one ✨


🌸 NAME 🌸

iommu_alloc_pages_node_sz β€” grab yourself a zeroed page of whatever size you want, from a specific NUMA node 🎯 no cap.


✨ SYNOPSIS ✨

void * iommu_alloc_pages_node_sz (int nid , gfp_t gfp , size_t size );

literally that's the whole vibe check right there πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • nid β€” the memory NUMA node id, aka which node you're shopping at πŸ›οΈ
  • gfp β€” the buddy allocator flags, the little knobs that say how you want it allocated
  • size β€” the memory size you wanna allocate, and yes it gets rounded up to a power of 2 (more on that below, iykyk)

πŸ¦‹ DESCRIPTION πŸ¦‹

So what you get back? The virtual address of the allocated page πŸ’– that's your prize.

now the important part, bestie, do NOT just leave it lying around:

The page must be freed, either by calling iommu_free_pages or via iommu_put_pages_list 🫢 fr fr, free your pages.

and here's the cute little detail about what you actually got: the returned allocation is round_up_pow_two(size) big πŸ”₯ and it's physically aligned to its size. iconic behavior honestly πŸ’…


🌈 SEE ALSO 🌈

peep the kernel file ./drivers/iommu/iommu-pages.c and then go read these besties:


and that's the whole page, periodt πŸ’…βœ¨ this cutie lives in ./drivers/iommu, dated October 2026, and it goes by iommu_alloc_pages_node_sz(9) β€” mwah, go allocate responsibly πŸ§šπŸ’œ

πŸ“¦ where this page comes from