summaryrefslogtreecommitdiff
path: root/drivers/gpu/ion/ion_system_heap.c
diff options
context:
space:
mode:
authorRebecca Schultz Zavin <rebecca@android.com>2012-09-25 20:55:27 -0700
committerArve Hjønnevåg <arve@android.com>2013-07-01 14:16:08 -0700
commit49cfb6da44fd228851d0d6410f8b2cf56a4be9bd (patch)
treed4391d00380a21abfa5db29e0b66c0ba5c144364 /drivers/gpu/ion/ion_system_heap.c
parentd8c1252e23beb4bec877828eeb8dc351fe09737b (diff)
downloadolio-linux-3.10-49cfb6da44fd228851d0d6410f8b2cf56a4be9bd.tar.xz
olio-linux-3.10-49cfb6da44fd228851d0d6410f8b2cf56a4be9bd.zip
gpu: ion: Stop trying to allocate from an order on first failure
With this patch the system heap will only try to allocate from each order as long as allocations succeed. If it failes to obtain a higher order allocation, it doesn't retry that order. Change-Id: I0d9144b4c30cc0e427acdcad2f1f12ae7f37f827 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Diffstat (limited to 'drivers/gpu/ion/ion_system_heap.c')
-rw-r--r--drivers/gpu/ion/ion_system_heap.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/gpu/ion/ion_system_heap.c b/drivers/gpu/ion/ion_system_heap.c
index 310c4f66cfa..00c91fe09d3 100644
--- a/drivers/gpu/ion/ion_system_heap.c
+++ b/drivers/gpu/ion/ion_system_heap.c
@@ -32,7 +32,8 @@ struct page_info {
};
static struct page_info *alloc_largest_available(unsigned long size,
- bool split_pages)
+ bool split_pages,
+ unsigned int max_order)
{
static unsigned int orders[] = {8, 4, 0};
struct page *page;
@@ -42,6 +43,8 @@ static struct page_info *alloc_largest_available(unsigned long size,
for (i = 0; i < ARRAY_SIZE(orders); i++) {
if (size < (1 << orders[i]) * PAGE_SIZE)
continue;
+ if (max_order < orders[i])
+ continue;
page = alloc_pages(GFP_HIGHUSER | __GFP_ZERO |
__GFP_NOWARN | __GFP_NORETRY, orders[i]);
if (!page)
@@ -71,13 +74,17 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
bool split_pages = ion_buffer_fault_user_mappings(buffer);
+ unsigned int max_order = orders[0];
+
INIT_LIST_HEAD(&pages);
while (size_remaining > 0) {
- info = alloc_largest_available(size_remaining, split_pages);
+ info = alloc_largest_available(size_remaining, split_pages,
+ max_order);
if (!info)
goto err;
list_add_tail(&info->list, &pages);
size_remaining -= (1 << info->order) * PAGE_SIZE;
+ max_order = info->order;
i++;
}