mem_used(9)
π mem_used(9) β the Kernel API Manual tea π
ok so this is mem_used, a lil function from the Kernel API Manual, and honestly? she's the main character of "how many slots are we even using rn" π
let's get into it bestie
β¨ NAME β¨
mem_used β get number of used slots in an allocator π
like literally, that's her whole job. she counts the used slots. iconic behavior, no notes.
πΈ SYNOPSIS πΈ
unsigned long mem_used (struct io_tlb_mem *mem );
that's it. one arg, returns an unsigned long, we love a low-maintenance queen π«Ά
π¦ ARGUMENTS π¦
memβ the Software IO TLB allocator π this is the allocator you're asking about, bestie, so hand her over
β DESCRIPTION β
okay so here's the vibe check on how accurate this number actually is, because it depends π
- When
trace_hiwaterandCONFIG_DEBUG_FSis enabled, the result is accurate, because the total number of used slots is tracked inmem->total_used. she's keeping receipts, fr fr π - Otherwise, the result is an approximation, because there is no locking of individual areas. no cap, it's just vibes at that point π
so yeah β sometimes you get the exact count, sometimes you get the spirit of the count π
π₯ RETURN π₯
Number of used slots. that's the whole return value, she's not doing extra π
π SEE ALSO π
Kernel file ./kernel/dma/swiotlb.c plus this whole friend group of functions, all hanging out together π«Ά:
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_alloc_pool(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)swiotlb_tbl_map_single(9)swiotlb_del_transient(9)is_swiotlb_allocated(9)default_swiotlb_base(9)default_swiotlb_limit(9)
ngl, if you're chasing an exact number, double-check whethertrace_hiwaterandCONFIG_DEBUG_FSare actually on before you @ her about it π
π and that's the page!! brought to you by ./kernel/dma, dated October 2026 β mwah, go read the source bestie, it's giving essential reading π§β¨
π¦ 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