dma-buf: Introduce dma_buf_put_sync()
dma_buf_put() is supposed to invoke the release dma-buf callback for
a dma-buf and free the memory when the dma-buf's refcount reaches 0.
However, when dma_buf_put() is invoked from a kernel thread (e.g.
kthread or kworker), the dma-buf is actually freed later on in time,
asynchronously, by a worker thread.
This behavior can cause issues where memory is allocated from an ION
heap, such as a CMA heap, and released from the context of a worker
thread, and the memory is allocated soon after the call to
dma_buf_put(). In that case, it is possible for the memory to not have
been freed yet.
Thus, introduce dma_buf_put_sync(), which ensures that the buffer is
freed when the function is called, and the buffer does not have any
outstanding references.
Change-Id: Iba63c968b16669013684861afd60c0212062412e
Signed-off-by:
Isaac J. Manjarres <isaacm@codeaurora.org>
Loading
Please register or sign in to comment