mem_used(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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_hiwater and CONFIG_DEBUG_FS is enabled, the result is accurate, because the total number of used slots is tracked in mem->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 🫢:


ngl, if you're chasing an exact number, double-check whether trace_hiwater and CONFIG_DEBUG_FS are 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