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

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

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: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent 2c04df9e
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