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: Deepak Kumar <dkumar@codeaurora.org>
This commit is contained in:
Deepak Kumar 2017-06-20 16:06:52 +05:30
parent 9725c4d90b
commit e8adb4c2b8

View file

@ -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 {
/*