free_device_memory(9)
π free_device_memory(9) π
okay so we're in the Kernel API Manual bestie, and this page is literally about free_device_memory β the function that frees device memory. no cap, that's the whole vibe π«Ά
β¨ SYNOPSIS β¨
int free_device_memory (struct hl_ctx *ctx , struct hl_mem_in *args );
like, yes, it's int β it gives you a return value back, she's not mysterious π
πΈ ARGUMENTS πΈ
ctxβ a pointer to the context structure. that's the ~context~ of the whole thing, keep it close πargsβ the host parameters containing the requested size. yeah, the size info lives in here π
π« DESCRIPTION π«
so here's what this function actually does, bestie (it's a short list, it's giving lowkey but iconic):
- Free the device memory related to the given handle.
that's it. that's the flex. you hand it the handle-adjacent stuff and the device memory tied to that handle gets freed, periodt β¨
π¦ SEE ALSO π¦
the kernel file herself lives at ./drivers/accel/habanalabs/common/memory.c β go look, iykyk π§
and here's the whole friend group of related calls, all of them, fr fr:
dma_map_host_va(9),dma_unmap_host_va(9),dram_pg_pool_do_release(9),free_phys_pg_pack(9),clear_va_list_locked(9),print_va_list_locked(9),merge_va_blocks_locked(9),add_va_block_locked(9),add_va_block(9),is_hint_crossing_range(9),get_va_block(9),hl_get_va_range_type(9),hl_unreserve_va_block(9),init_phys_pg_pack_from_userptr(9),map_phys_pg_pack(9),unmap_phys_pg_pack(9),map_device_va(9),unmap_device_va(9),hl_hw_block_mmap(9),export_dmabuf_from_addr(9),allocate_timestamps_buffers(9),hl_pin_host_memory(9),hl_userptr_delete_list(9),hl_userptr_is_pinned(9),va_range_init(9),va_range_fini(9),vm_ctx_init_with_ranges(9),hl_vm_ctx_fini(9),hl_vm_init(9),hl_vm_fini(9),hl_hw_block_mem_init(9),hl_hw_block_mem_fini(9)
like, that's the entire roster, nobody left out ππ
ngl, nothing scary flagged on this one β no deprecation warnings, no undefined behaviour drama, just a tidy little free. but always actually read your return value, bestie π
okay and for the cute sign-off: this page is from ./drivers/accel/habanalabs/common, dated October 2026, and it's page free_device_memory(9) of the Kernel API Manual π that's the whole footer, mwah, bye bestie πβ
π¦ 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