summaryrefslogtreecommitdiff
path: root/drivers/gpu/ion/ion_system_heap.c
AgeCommit message (Collapse)Author
2013-11-07ion: move into stagingColin Cross
Move ion from drivers/gpu/ion to drivers/android/staging/ion. Change-Id: Id6e996aa3954cbb8e1a8abc9578a56204f5eb211 Signed-off-by: Colin Cross <ccross@android.com>
2013-09-19gpu: ion: Fix performance issue in faulting codeRebecca Schultz Zavin
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>
2013-07-01gpu: ion: Remove __GFP_NO_KSWAPDArve Hjønnevåg
It no longer exists. Signed-off-by: Arve Hjønnevåg <arve@android.com>
2013-07-01gpu: ion: __dma_page_cpu_to_dev -> arm_dma_ops.sync_single_for_device hackArve Hjønnevåg
Signed-off-by: Arve Hjønnevåg <arve@android.com>
2013-07-01gpu: ion: Also shrink memory cached in the deferred free listRebecca Schultz Zavin
When the system is low on memory, we want to shrink any cached system memory ion is holding. Previously we were shrinking memory in the page pools, but not in the deferred free list. This patch makes it possible to shrink both. It also moves the shrinker code into the heaps so they can correctly manage any caches they might contain. Change-Id: I177f587f999a5220eddbf7af94745aae736cac75 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Make ion_free asynchronousRebecca Schultz Zavin
Add the ability for a heap to free buffers asynchrounously. Freed buffers are placed on a free list and freed from a low priority background thread. If allocations from a particular heap fail, the free list is drained. This patch also enable asynchronous frees from the chunk heap. Change-Id: Idfdbc8608b6cbd9e27d2e31ea4fd84fea9f69f7d Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Refactor the code to zero buffersRebecca Schultz Zavin
Refactor the code in the system heap used to map and zero the buffers into a seperate utility so it can be called from other heaps. Use it from the chunk heap. Change-Id: I706341ae42b80bc4aae8a8614b4f73435bbf05d9 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Modify zeroing code so it only allocates address space onceRebecca Schultz Zavin
vmap/vunmap spend a significant amount of time allocating the address space to map into. Rather than allocating address space for each page, instead allocate once for the entire allocation and then just map and unmap each page into that address space. Change-Id: I4a5c850717c80f75506a36b7ec2bcd55857b8dea Signed-off-by: Rebecca Schultz Zavin <rschultz@google.com>
2013-07-01gpu: ion: Refactor common mapping functions out of system heapRebecca Schultz Zavin
The system heap contained several general purpose functions to map buffers to the kernel and userspace. This patch refactors those into ion_heap.c so they can be used by other heaps. Change-Id: If64591798bdc2c248bf9064ace2c927909d7adb8 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Fix bug in zeroing pages in system heapRebecca Schultz Zavin
Pages are zeroed for security purposes when returned to the ion heap. There was a bug in this code preventing this from happening. Bug: 7573871 Change-Id: I79c22ee1da98f306199f3a192eaec4e81d5fd059 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Fix bug in ion_system_heap map_userRebecca Schultz Zavin
When the requested mmap length was not an integer number of chunks or the buffer, or if an offset was provided, a bug would cause extra or incorrect pages of the buffer to be mapped. Change-Id: I2766763d86048f026eeef0e0388b7de0e25c2093 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Don't flush allocatoins that come from the page poolsRebecca Schultz Zavin
Change-Id: Ib08cb2cea3b6ea4b1ebf5a1b28abe6b9374fd2bd Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Clear GFP_WAIT flag on high order allocationsRebecca Schultz Zavin
This will prevent the kernel from kicking off compaction when higher order allocations are made. Instead we will get these high order allocations only if they are readily available. Change-Id: I5c038781ef4028c1c0a1a52b6cb549d26550a124 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Fix several issues with page poolRebecca Schultz Zavin
Split out low and high mem pages so they are correctly reported when the shrinker is called. Fix potential deadlock caused by holding the page pool lock while allocationg and also needing that lock from the shrink function Change-Id: I6def3a3111f59914ef6b5b59d81a6fde37cb60c5 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Modify gfp flags in ion_system_heapRebecca Schultz Zavin
When allocations larger than order 4 are made, use _GFP_NORETRY and __GFP_NO_KSWAPD so kswapd doesn't get kicked off to reclaim these larger chunks. For smaller allocaitons, these are unnecessary, as the system should be able to reclaim these. Change-Id: I6b45cd1a595d25cc39622e3dbcc04d84fa1b7db8 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Use the ion_page_pool from the system heapRebecca Schultz Zavin
With this change the system heap will use pagepools to avoid having to invalidate memory when it is allocated, a significant performance improvement on some systems. Change-Id: I96ab778d67c4b19805883dcfa44d750811cdff48 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: use vmalloc to allocate page array to map kernelRebecca Schultz Zavin
When ion_map_kernel is execute the system must allocate an array large enough to hold a pointer to each page in the buffer. If the buffer is very large and the system memory has become very fragmented, there may not be sufficient high order allocations available from kmalloc. Use vmalloc instead. Change-Id: I5fabf79be6cfd158f7805bfca6267a60c4708582 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: ion_system_heap: Fix bug preventing compilationRebecca Schultz Zavin
Change-Id: I91d77492b99d09c7abdfaa09df280a20ee83f428 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Stop trying to allocate from an order on first failureRebecca Schultz Zavin
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>
2013-07-01gpu: ion: optimize system heap for non fault buffersRebecca Schultz Zavin
If a buffer's user mappings are not going to be faulted in it need not be allocated page wise. We can optimize this common case by allocating an sglist of larger chunks rather than creating an entry for each page in the allocation. Change-Id: I47814990e55c7bdb7abeaa2af824744b0a97602d Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Switch to using kmalloc rather than kmap during allocationRebecca Schultz Zavin
Previously, metadata was stored in the allocated pages themselves during allocation. However the system can only have a limited number of kmapped pages. A very large allocation might exceed this limit. Change-Id: Ibe972096e83924bf5e621d8282c4cd133ca75b0a Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Only map as much of the vma as the user requestedRebecca Schultz Zavin
Change-Id: If0e368e192941c118683ab74aed48e4e0cb5731d Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: do not ask for compound pages in system heapDima Zavin
Change-Id: If84b246ec984ee2ae7b0174c714c8ce7726a6ab1 Signed-off-by: Dima Zavin <dima@android.com>
2013-07-01gpu: ion: Modify the system heap to try to allocate large/huge pagesRebecca Schultz Zavin
On some systems there is a performance benefit to reducing tlb pressure by minimizing the number of chunks in an allocation. Change-Id: Ie6ff215a5f32a837bf3103f79a09748e38759f0e Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Add cache maintenance to ion.Rebecca Schultz Zavin
This patch adds cache maintenance operations to ion. As per mailing list discussions regarding dma_buf, cache operations are done implicitly. At buffer allocaiton time the user can select whether he'd like mappings (both kernel and user) to be cached. When cached mappings are selected, no mappings will be created for a buffer at mmap time. Instead pages will be faulted in one at a time so we can track which pages require flushing before dma. When the buffers are mapped for dma (via the dma_buf apis) any pages which were touched will be synced for device. Change-Id: Id5d6894e8bb52af038c91dd895143bf3b4203b0b Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: ion_system_heap: Change allocations to GFP_HIGHUSERRebecca Schultz Zavin
Previously the ion_system_heap was using GFP_KERNEL, forcing all allocations to be in lowmem. This quickly causes us to run out of lowmem. Change-Id: I6d502a5f1c20c8a8e44fb5903fcb228f8435a564 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Use alloc_pages instead of vmalloc from the system heapRebecca Schultz Zavin
With this change the ion_system_heap will only use kernel address space when the memory is mapped into the kernel (rare case). Change-Id: I8702cf89ffec0bd5c337bd88d7444013d4d94bc8 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01ion: Switch map/unmap dma api to sg_tablesRebecca Schultz Zavin
Switch these api's from scatterlists to sg_tables Change-Id: I8b99e39633df009d472ce24704fa26af7bb50fa2 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-07-01gpu: ion: Add ION Memory ManagerRebecca Schultz Zavin
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>