ion: retry during race with shrinking/allocating
There exists a race between shrinking/allocating
Thread 1: Thread:2
mutex_lock(&sheap->alloc_lock)
ion_secure_cma_add_to_pool()
mutex_lock(&sheap->chunk_lock)
chunk->cnt = 0
mutex_unlock(&sheap->chunk_lock)
ion_secure_cma_shrinker
mutex_lock(&sheap->chunk_lock)
__ion_secure_cma_shrink_pool
chunk->cnt == 0 for the
just allocated chunk
ion_secure_cma-free_chunk
ion_secure_cma_alloc_from_pool
no memory to allocate!
If this race happens, just retry adding memory to the pool instead
of BUGing out the system.
Change-Id: Ic95782db6d88a33f01dcc5248fc957ca0f378078
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
1 file changed