diff options
author | Mitchel Humpherys <mitchelh@codeaurora.org> | 2013-08-06 15:08:23 -0700 |
---|---|---|
committer | Mitchel Humpherys <mitchelh@codeaurora.org> | 2013-12-19 21:02:18 -0800 |
commit | 14f162cb64a8beca59f06cd94d5569bd550dc99d (patch) | |
tree | 0a73bd35165e0d6aafda9b1f7185a8ea3bf899d9 /drivers/staging/android/ion/ion_system_heap.c | |
parent | 550640ca7aec7789cdd52742b4c1d9dd712a5dd8 (diff) |
ion: Add private buffer flag to skip page pooling on free
Currently, when we free a buffer it might actually just go back into a
heap-specific page pool rather than going back to the system. This poses
a problem because sometimes (like when we're running a shrinker in low
memory conditions) we need to force the memory associated with the
buffer to truly be relinquished to the system rather than just going
back into a page pool.
There isn't a use case for this flag by Ion clients, so make it a
private flag. The main use case right now is to provide a mechanism for
the deferred free code to force stale buffers to bypass page pooling.
Change-Id: I724f89cc037083fe8576784363caa18a34e8705a
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Diffstat (limited to 'drivers/staging/android/ion/ion_system_heap.c')
-rw-r--r-- | drivers/staging/android/ion/ion_system_heap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index 4a87fcf5326..a2c8968104f 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -90,7 +90,7 @@ static void free_buffer_page(struct ion_system_heap *heap, { bool cached = ion_buffer_cached(buffer); - if (!cached) { + if (!cached && !(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE)) { struct ion_page_pool *pool = heap->pools[order_to_index(order)]; ion_page_pool_free(pool, page); } else { @@ -205,7 +205,7 @@ static void ion_system_heap_free(struct ion_buffer *buffer) /* uncached pages come from the page pools, zero them before returning for security purposes (other allocations are zerod at alloc time */ - if (!cached) + if (!cached && !(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE)) ion_heap_buffer_zero(buffer); for_each_sg(table->sgl, sg, table->nents, i) |