swiotlb_alloc_pool(9)
π 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 fornslabs, settling is allowed, but going underminslabsis 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:
struct io_tlb_slot(9)struct io_tlb_area(9)swiotlb_adjust_nareas(9)limit_nareas(9)add_mem_pool(9)alloc_dma_pages(9)swiotlb_alloc_tlb(9)swiotlb_free_tlb(9)swiotlb_dyn_alloc(9)__swiotlb_find_pool(9)swiotlb_del_pool(9)swiotlb_dev_init(9)swiotlb_align_offset(9)swiotlb_search_pool_area(9)swiotlb_search_area(9)swiotlb_find_slots(9)mem_pool_used(9)mem_used(9)swiotlb_tbl_map_single(9)swiotlb_del_transient(9)is_swiotlb_allocated(9)default_swiotlb_base(9)default_swiotlb_limit(9)
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
- 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