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

Commit 8a8fd742 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ion: add support for non-pool allocations"

parents 9bcdbe6e a5d2ef95
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/err.h>
#include <linux/highmem.h>
#include <linux/mm.h>
#include <linux/msm_ion.h>
#include <linux/scatterlist.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
@@ -78,11 +79,19 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap,
	struct page *page;
	struct ion_page_pool *pool;

	if (*from_pool) {
		if (!cached)
			pool = heap->uncached_pools[order_to_index(order)];
		else
			pool = heap->cached_pools[order_to_index(order)];
		page = ion_page_pool_alloc(pool, from_pool);
	} else {
		gfp_t gfp_mask = low_order_gfp_flags;

		if (order)
			gfp_mask = high_order_gfp_flags;
		page = alloc_pages(gfp_mask, order);
	}
	if (!page)
		return 0;

@@ -95,7 +104,8 @@ static void free_buffer_page(struct ion_system_heap *heap,
{
	bool cached = ion_buffer_cached(buffer);

	if (!(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE)) {
	if (!(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE) &&
	    !(buffer->flags & ION_FLAG_POOL_FORCE_ALLOC)) {
		struct ion_page_pool *pool;
		if (cached)
			pool = heap->cached_pools[order_to_index(order)];
@@ -127,6 +137,7 @@ static struct page_info *alloc_largest_available(struct ion_system_heap *heap,
			continue;
		if (max_order < orders[i])
			continue;
		from_pool = !(buffer->flags & ION_FLAG_POOL_FORCE_ALLOC);

		page = alloc_buffer_page(heap, buffer, orders[i], &from_pool);
		if (!page)
@@ -327,7 +338,8 @@ void ion_system_heap_free(struct ion_buffer *buffer)
	LIST_HEAD(pages);
	int i;

	if (!(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE))
	if (!(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE) &&
	    !(buffer->flags & ION_FLAG_POOL_FORCE_ALLOC))
		msm_ion_heap_buffer_zero(buffer);

	for_each_sg(table->sgl, sg, table->nents, i)