dma_buf_put(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… dma_buf_put β€” a Kernel API Manual moment (yes, that's the 9 section, iykyk)

okay so bestie, welcome to the group chat. this page lives in the Kernel API Manual and it's literally about letting go of a buffer. one function, huge main character energy. let's get into it πŸ’–


🌸 NAME 🌸

dma_buf_put β€” decreases refcount of the buffer

like, it's the "okay bye ily but I'm leaving" of reference counting. no cap.


✨ SYNOPSIS ✨

void dma_buf_put (struct dma_buf *dmabuf );

that's it. that's the whole signature. she's simple, she's iconic, she returns nothing (void) and she's not sorry about it. πŸŽ€


🫢 ARGUMENTS 🫢

  • dmabuf β€” [in] the buffer to reduce refcount of. that's your little guy. you're lowering his refcount. be gentle. πŸ¦‹

πŸ’… DESCRIPTION πŸ’…

so here's the tea: this function uses the file's refcounting, and that refcounting is done implicitly by fput. no extra work from you, it just vibes through the file layer. ✨

now the dramatic part β€” if, as a result of this call, the refcount becomes 0, then the 'release' file operation related to this fd gets called. and that in turn calls the dma_buf_ops.release vfunc, and frees the memory allocated for dmabuf when it was exported. so it's giving final rose ceremony. when the count hits zero, the memory gets its goodbye moment. πŸ˜­πŸ‘‘

ngl this is the important bit: the cleanup doesn't happen at some random time. it happens on this call, the one that drops the count to 0. so like, mind your refcounts bestie. πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

that's the whole friend group. the dma_buf_get / dma_buf_put duo is literally the classic paired set β€” grab one, put one back. iykyk πŸ’œ


and that's the page bestie! 🌈 this one comes to you from ./drivers/dma-buf, dated October 2026, and the page itself is dma_buf_put(9). go forth and decrement responsibly. mwah πŸ“πŸ§šπŸ’–

πŸ“¦ where this page comes from