soc: qcom: mem-buf: Ensure dma-bufs are freed when refcount is 0
When mem-buf frees a dma-buf (i.e. calls dma_buf_put() and it is
guaranteed that the refcount will be 0), it does so from the context of
a kworker. As a result of this, dma_buf_put() will free the dma-buf
asynchronously, which means that it is possible that the buffer has
not been freed when dma_buf_put() is invoked.
In the case where memory is being reclaimed by the primary VM, and
another VM requests the memory again soon after relinquishing it,
this situation results in failing the memory allocation, as the buffer
is still in the process of being freed. Thus, use dma_buf_put_sync()
to ensure that the buffer is freed whenever mem-buf needs to free
a dma-buf.
Change-Id: I60af08a143b91eddb6738f65cc8e943cf04065ad
Signed-off-by:
Isaac J. Manjarres <isaacm@codeaurora.org>
Loading
Please register or sign in to comment