swiotlb_alloc_pool(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– swiotlb_alloc_pool(9) πŸ’–

okay so bestie, we're in the <pink>Kernel API Manual</pink> today and the main character is swiotlb_alloc_pool β€” yes that's a 9 in the parens, that means kernel-internal function, we're in the deep docs now 🫢


✨ NAME ✨

swiotlb_alloc_pool β€” literally just allocate a brand new IO TLB memory pool, that's it, that's the whole vibe πŸ’…


🌸 SYNOPSIS 🌸

struct io_tlb_pool * swiotlb_alloc_pool (struct device *dev , struct
io_tlb_mem *mem , unsigned long minslabs , unsigned long nslabs ,
unsigned int nareas , u64 phys_limit , gfp_t gfp );

seven (7) arguments, count 'em, she's a whole function signature πŸ”₯


πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the device we're out here allocating a memory pool for. she's the reason we're all here ngl.
  • mem β€” the SWIOTLB allocator that owns this pool. the pool's home base, iykyk.
  • minslabs β€” the minimum number of slabs. this is the floor, we cannot go below it, no cap.
  • nslabs β€” the desired (aka maximum) number of slabs. we want this many, but see DESCRIPTION, she's flexible πŸ™ˆ
  • nareas β€” how many areas. just... the number of areas bestie.
  • phys_limit β€” the maximum DMA buffer physical address. the ceiling, literally and physically πŸ’€
  • gfp β€” the GFP flags used for the allocations. very important, do not skip.

πŸ¦‹ DESCRIPTION πŸ¦‹

So what she does is: allocate and initialize a shiny new IO TLB memory pool ✨

the way that the actual number of slabs may be reduced if allocating nslabs fails... lowkey humbling. she'll take what she can get. BUT β€” and this is the important part β€” if even minslabs cannot be allocated, this function fails. periodt. no pool for you. 😭

so: trying for nslabs, settling is allowed, but going under minslabs is a hard no. 🚫

⭐ RETURN ⭐

The new memory pool πŸ’– β€” or NULL on allocation failure πŸ˜” (it happens to the best of us).


🌈 SEE ALSO 🌈

Kernel file ./kernel/dma/swiotlb.c and its whole friend group:

she's got a lot of mutuals, we love a well-connected icon πŸ‘‘


okay that's the whole page!! this one's from ./kernel/dma, dated October 2026, and if you need to find her again just look up swiotlb_alloc_pool(9) β€” mwah πŸ’‹πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from