diff options
| author | Rebecca Schultz Zavin <rebecca@android.com> | 2013-06-12 15:22:16 -0700 |
|---|---|---|
| committer | Colin Cross <ccross@android.com> | 2013-09-19 13:50:13 -0500 |
| commit | bbf5538ee0e4c30ba9b4556f9699ed5f31df67da (patch) | |
| tree | 09468f71dd29ce2f392e4f527f0c25db2c03f2fe /drivers/gpu/ion/ion_system_heap.c | |
| parent | ae2b22e9b7a207d9392df5b5ec93b8c042d4b3ce (diff) | |
| download | olio-linux-3.10-bbf5538ee0e4c30ba9b4556f9699ed5f31df67da.tar.xz olio-linux-3.10-bbf5538ee0e4c30ba9b4556f9699ed5f31df67da.zip | |
gpu: ion: Fix performance issue in faulting code
Previously the code to fault ion buffers in one page at a time had a
performance problem caused by the requirement to traverse the sg list
looking for the right page to load in (a result of the fact that the items in
the list may not be of uniform size). To fix the problem, for buffers
that will be faulted in, also keep a flat array of all the pages in the buffer
to use from the fault handler. To recover some of the additional memory
footprint this creates per buffer, dirty bits used to indicate which
pages have been faulted in to the cpu are now stored in the low bit of each
page struct pointer in the page array.
Change-Id: I891b077dc0c88ed6d416b256626d8778fd67be84
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.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/drivers/gpu/ion/ion_system_heap.c b/drivers/gpu/ion/ion_system_heap.c index e101db5da5b..5fe81a76f2f 100644 --- a/drivers/gpu/ion/ion_system_heap.c +++ b/drivers/gpu/ion/ion_system_heap.c @@ -64,7 +64,6 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap, unsigned long order) { bool cached = ion_buffer_cached(buffer); - bool split_pages = ion_buffer_fault_user_mappings(buffer); struct ion_page_pool *pool = heap->pools[order_to_index(order)]; struct page *page; @@ -75,7 +74,7 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap, if (order > 4) gfp_flags = high_order_gfp_flags; - page = alloc_pages(gfp_flags, order); + page = ion_heap_alloc_pages(buffer, gfp_flags, order); if (!page) return 0; arm_dma_ops.sync_single_for_device(NULL, @@ -85,8 +84,6 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap, if (!page) return 0; - if (split_pages) - split_page(page, order); return page; } @@ -153,7 +150,6 @@ static int ion_system_heap_allocate(struct ion_heap *heap, int i = 0; long size_remaining = PAGE_ALIGN(size); unsigned int max_order = orders[0]; - bool split_pages = ion_buffer_fault_user_mappings(buffer); INIT_LIST_HEAD(&pages); while (size_remaining > 0) { @@ -170,28 +166,15 @@ static int ion_system_heap_allocate(struct ion_heap *heap, if (!table) goto err; - if (split_pages) - ret = sg_alloc_table(table, PAGE_ALIGN(size) / PAGE_SIZE, - GFP_KERNEL); - else - ret = sg_alloc_table(table, i, GFP_KERNEL); - + ret = sg_alloc_table(table, i, GFP_KERNEL); if (ret) goto err1; sg = table->sgl; list_for_each_entry_safe(info, tmp_info, &pages, list) { struct page *page = info->page; - if (split_pages) { - for (i = 0; i < (1 << info->order); i++) { - sg_set_page(sg, page + i, PAGE_SIZE, 0); - sg = sg_next(sg); - } - } else { - sg_set_page(sg, page, (1 << info->order) * PAGE_SIZE, - 0); - sg = sg_next(sg); - } + sg_set_page(sg, page, (1 << info->order) * PAGE_SIZE, 0); + sg = sg_next(sg); list_del(&info->list); kfree(info); } |