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

Commit ce925b21 authored by Deepak Kumar's avatar Deepak Kumar
Browse files

msm: kgsl: Directly return page size of the supported pool



In current code, if a request comes to allocate a page of a size
for which pool is not supported EAGAIN is returned with a page
size of PAGE_SIZE << --order. This is not efficient as it results
in multiple retries in case pool of size = PAGE_SIZE << --order is
also not supported.

Instead of retrying with lower order page in a sequential manner
this change directly returns the page size of the pool that is
supported.

Change-Id: Ib82ae5be7e4109fdc0a3d72bcbcd4b47cfb2e266
Signed-off-by: default avatarDeepak Kumar <dkumar@codeaurora.org>
parent a2005826
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -280,6 +280,17 @@ static int kgsl_pool_idx_lookup(unsigned int order)
	return -ENOMEM;
}

static int kgsl_pool_get_retry_order(unsigned int order)
{
	int i;

	for (i = kgsl_num_pools-1; i > 0; i--)
		if (order >= kgsl_pools[i].pool_order)
			return kgsl_pools[i].pool_order;

	return 0;
}

/**
 * kgsl_pool_alloc_page() - Allocate a page of requested size
 * @page_size: Size of the page to be allocated
@@ -326,7 +337,7 @@ int kgsl_pool_alloc_page(int *page_size, struct page **pages,
	if (pool == NULL) {
		/* Retry with lower order pages */
		if (order > 0) {
			size = PAGE_SIZE << --order;
			size = PAGE_SIZE << kgsl_pool_get_retry_order(order);
			goto eagain;
		} else {
			/*