Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 2c04df9e authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

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: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent 9a64d016
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment