summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* ion: fix dma APIsColin Cross2013-12-145-19/+42
| | | | | | | | | | | | | | | __dma_page_cpu_to_dev is a private ARM api that is not available on 3.10 and was never available on other architectures. We can get the same behavior by calling dma_sync_sg_for_device with a scatterlist containing a single page. It's still not quite a kosher use of the dma apis, we still conflate physical addresses with bus addresses, but it should at least compile on all platforms, and work on any platform that doesn't have a physical to bus address translation. Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: fix crash when alloc len is -1Colin Cross2013-12-141-3/+3
| | | | | | | | | | | | | If userspace passes a length between -4095 and -1 to allocate it will pass the len != 0 check, but when len is page aligned it will be 0. Check len after page aligning. Drop the warning as well, userspace shouldn't be able to trigger a warning in the kernel. Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: hold reference to handle after ion_uhandle_getColin Cross2013-12-141-15/+41
| | | | | | | | | | | | | | | | | | | | | | | commit 1262ab1846cf76f7549c66ef709120dbfbe6d49f (ion: replace userspace handle cookies with idr) broke the locking in ion. The ION_IOC_FREE and ION_IOC_MAP ioctls were relying on ion_handle_validate to detect the case where a call raced with another ION_IOC_FREE which may have freed the struct ion_handle. Rename ion_uhandle_get to ion_handle_get_by_id, and have it take the client lock and return with an extra reference to the handle. Make each caller put its reference once it is done with the handle. Also modify users of ion_handle_validate to continue to hold the client lock after calling ion_handle_validate until they are done with the handle, and warn if ion_handle_validate is called without the client lock held. Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: Fix compat support to use proper compat ioctl numbersJohn Stultz2013-12-141-7/+12
| | | | | | | | | | | | | The compat support added to ion didn't provide compat ioctl numbers (who's value depends on the compat structure size). So 32bit applications would get an error when trying to make ioctl calls. This patch adds the needed COMPAT_ macros and uses them in the compat_ion_ioctl, translating them to their non-compat cmd when calling the normal ioctl call. Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: move userspace api into uapi/ion.hColin Cross2013-12-143-176/+198
| | | | | | | | | Split the userspace api out of drivers/staging/android/ion/ion.h into drivers/staging/android/uapi/ion.h Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: delete ion_system_mapper.cColin Cross2013-12-141-114/+0
| | | | | | | | | | The mapper abstraction layer was removed before the initial ion commit, but a stray ion_system_mapper.c file was left in. Delete it. Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: add compat_ioctlRom Lemarchand2013-12-144-0/+207
| | | | | | | | | Add a compat_ioctl to the ion driver Signed-off-by: Rom Lemarchand <romlem@google.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: change ion_user_handle_t definition to intRom Lemarchand2013-12-142-6/+6
| | | | | | | | | | Turn ion_user_handle_t to int. This change reflects the underlying type returned by the ion driver. Signed-off-by: Rom Lemarchand <romlem@google.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: add new ion_user_handle_t type for the user-space tokenRom Lemarchand2013-12-142-5/+7
| | | | | | | | | | | | | Declare new ion_user_handle_t type to contain the token returned to user-space. This allows a 2-step migration of the user-space code to a new kernel header first, then will allow us to change the definition of the ion_user_handle_type_t to int without breaking the API. Signed-off-by: Rom Lemarchand <romlem@google.com> (cherry picked from commit ebb8269bbb05b06ecedca3e21b3e65f23d48eadd) [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: don't use id 0 for handle cookieColin Cross2013-12-141-1/+1
| | | | | | | | | | | ion userspace clients think that the cookie is a pointer, so they use NULL to check if the handle has been initialized. Set the first id number to 1. Signed-off-by: Colin Cross <ccross@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: index client->handles rbtree by bufferColin Cross2013-12-141-9/+12
| | | | | | | | | | | | The only remaining users of the client->handles rbtree are iterating through it like a list. Keep the rbtree, but change its index to be the buffer address instead of the handle address, which makes ion_handle_lookup a fast rbtree search. Signed-off-by: Colin Cross <ccross@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: replace userspace handle cookies with idrColin Cross2013-12-141-36/+71
| | | | | | | | | | | | | Userspace handles should not leak kernel virtual addresses to userspace. They have to be validated by looking them up in an rbtree anyways, so replace them with an idr and validate them by using idr_find to convert the id number to the struct ion_handle pointer. Signed-off-by: Colin Cross <ccross@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: remove IS_ERR_OR_NULLColin Cross2013-12-142-13/+18
| | | | | | | | | | | | | | | | | | | IS_ERR_OR_NULL is often part of a bad pattern that can accidentally return 0 on error: if (IS_ERR_OR_NULL(ptr)) return PTR_ERR(ptr); It also usually means that the errors of a function are not well defined. Replace all uses in ion.c by ensure that the return type of any function in ion is an ERR_PTR. Specify that the expected return value from map_kernel or map_dma heap ops is ERR_PTR, and warn if a heap returns NULL. Signed-off-by: Colin Cross <ccross@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: convert map_kernel to return ERR_PTRColin Cross2013-12-142-1/+9
| | | | | | | | | ion is going to stop accepting NULL as an error value, use ERR_PTR. Signed-off-by: Colin Cross <ccross@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: add free list size to heap debug filesColin Cross2013-12-141-0/+3
| | | | | | | Signed-off-by: Colin Cross <ccross@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: chunk_heap: fix leak in allocated counterColin Cross2013-12-141-6/+9
| | | | | | | | | | | buffer->size is controlled by the outer ion layer, don't modify it inside the heap. Instead, compute the rounded up allocated size on demand. Signed-off-by: Colin Cross <ccross@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Fix performance issue in faulting codeRebecca Schultz Zavin2013-12-145-104/+99
| | | | | | | | | | | | | | | | | 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. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: add CMA heapBenjamin Gaignard2013-12-145-2/+249
| | | | | | | | | | | | | | New heap type ION_HEAP_TYPE_DMA where allocation is done with dma_alloc_coherent API. device coherent_dma_mask must be set to DMA_BIT_MASK(32). ion_platform_heap private field is used to retrieve the device linked to CMA, if NULL the default CMA area is used. ion_cma_get_sgtable is a copy of dma_common_get_sgtable function which should be in kernel 3.5 Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: fix ion_platform_data definitionBenjamin Gaignard2013-12-141-1/+1
| | | | | | | | | fix ion_platform_heap to make is use an usual way in board configuration file. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ion: Add Kconfig dependency to ARMJohn Stultz2013-12-141-0/+1
| | | | | | | | | | | | | | | | | The ion code has some very specific arm-isms which keeps it from building on other architectures. These should probably be resolved, but in the mean time, add a dependency on CONFIG_ARM to avoid build failures. v2: Fix earlier flub, sending out an early untested version of the patch. Cc: Arve Hjønnevåg <arve@android.com> Cc: Rebecca Schultz Zavin <rebecca@android.com> Cc: Android Kernel Team <kernel-team@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Remove __GFP_NO_KSWAPDArve Hjønnevåg2013-12-141-2/+2
| | | | | | | | | It no longer exists. Signed-off-by: Arve Hjønnevåg <arve@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: __dma_page_cpu_to_dev -> arm_dma_ops.sync_single_for_device hackArve Hjønnevåg2013-12-143-8/+13
| | | | | | | Signed-off-by: Arve Hjønnevåg <arve@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Also shrink memory cached in the deferred free listRebecca Schultz Zavin2013-12-145-176/+278
| | | | | | | | | | | | | | 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. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Fix bug in ion shrinkerRebecca Schultz Zavin2013-12-141-2/+1
| | | | | | | | | The high variable was sometimes used uninitialized Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: ion_chunk_heap: Zero chunk heap memory at creation timeRebecca Schultz Zavin2013-12-141-2/+32
| | | | | | | | | | | | Allocations from the ion heap need to be zeroed to protect userspace from seeing memory belonging to other processes. First allocations from this heap were not zero'd allowing users to see memory from other processes on a warm reset. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: fix kfree/list_del orderJP Abgrall2013-12-141-1/+1
| | | | | | | | | | | | With CONFIG_SLUB_DEBUG_ON it would panic during ion_alloc() ion_buffer_create() io_heap_drain_freelist() Signed-off-by: JP Abgrall <jpa@google.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Make ion_free asynchronousRebecca Schultz Zavin2013-12-145-12/+126
| | | | | | | | | | | | 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. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Add support for sharing buffers with dma buf kernel handlesJohan Mossberg2013-12-142-8/+30
| | | | | | | | | | | | | | Currently ion can only share buffers with dma buf fd's. Fd's can not be used inside the kernel as they are process specific so support for sharing buffers with dma buf kernel handles is needed to support kernel only use cases. An example use case could be a GPU driver using ion that wants to share its output buffers with a 3d party display controller driver supporting dma buf. Signed-off-by: Johan Mossberg <johan.mossberg@stericsson.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Only flush buffers in the chunk heap if they were used cachedRebecca Schultz Zavin2013-12-141-2/+3
| | | | | | | Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Refactor the code to zero buffersRebecca Schultz Zavin2013-12-144-26/+48
| | | | | | | | | | | 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. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Modify zeroing code so it only allocates address space onceRebecca Schultz Zavin2013-12-141-7/+21
| | | | | | | | | | | | 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. Signed-off-by: Rebecca Schultz Zavin <rschultz@google.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Remove heapmask from clientRebecca Schultz Zavin2013-12-142-13/+5
| | | | | | | | | | The heapmask in the client generally wasn't being used. This patch removes it. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Export ion_client_createJohan Mossberg2013-12-141-0/+1
| | | | | | | | | Will enable modules to allocate memory with ion. Signed-off-by: Johan Mossberg <johan.mossberg@stericsson.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Clarify variable names and comments around heap ids v typesRebecca Schultz Zavin2013-12-142-41/+47
| | | | | | | | | | | | There is some confusion between when to use the heap type and when the id. This patch clarifies this by using clearer variable names and describing the intention in the comments. Also fixes the client debug code to print heaps by id instead of type. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Add chunk heapRebecca Schultz Zavin2013-12-145-2/+189
| | | | | | | | | | | | This patch adds support for a chunk heap that allows for buffers that are made up of a list of fixed size chunks taken from a carveout. Chunk sizes are configured when the heaps are created by passing the chunk size in the priv field of the heap platform data. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Refactor common mapping functions out of system heapRebecca Schultz Zavin2013-12-143-78/+91
| | | | | | | | | | | 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. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Switch heap rbtree to a prio listRebecca Schultz Zavin2013-12-142-29/+10
| | | | | | | | | | | | | | Switches the rbtree tree of heaps for a plist. This significantly simplifies the code and the list is small and is modified only at first boot so the rbtree is unnecessary. This also switches the traversal of the heap list to traverse from highest to lowest id's. This allows allocations to pass a heap mask that falls back on the system heap -- typically id 0, which is the common case. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Fix bug where MAP ioctl was no longer supportedRebecca Schultz Zavin2013-12-141-0/+1
| | | | | | | Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Modify reserve function for carveouts with no start addressRebecca Schultz Zavin2013-12-141-7/+26
| | | | | | | | | | | This patch allows you to specify a heap that requires carveout memory but that doesn't specify a start address. Memblock_alloc will be called to find a location for these heaps. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: fix compilation warningBenjamin Gaignard2013-12-141-1/+2
| | | | | | | | | use atomic_read to get the refcount value to avoid compilation warning Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: fix carveout opsBenjamin Gaignard2013-12-141-0/+2
| | | | | | | | | | when using carveout heap ion_buffer_create function failed because map_dma and unmap_dma operations aren't set by carveout heap. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Fix bug in zeroing pages in system heapRebecca Schultz Zavin2013-12-141-1/+1
| | | | | | | | | | | | 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 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Fix bug in ion_system_heap map_userRebecca Schultz Zavin2013-12-141-6/+15
| | | | | | | | | | | 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. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Don't flush allocatoins that come from the page poolsRebecca Schultz Zavin2013-12-141-3/+5
| | | | | | | Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Clear GFP_WAIT flag on high order allocationsRebecca Schultz Zavin2013-12-141-1/+1
| | | | | | | | | | | | 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. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Refactor lockingRebecca Schultz Zavin2013-12-141-20/+25
| | | | | | | | | | | | Removes contention for lock between allocate and free by reducing the length of time the lock is held for. Split out a seperate lock to protect the list of heaps and replace it with a rwsem since the list will most likely only be updated during initialization. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Switch to using a single shrink functionRebecca Schultz Zavin2013-12-142-30/+123
| | | | | | | | | The single shrink function will free lower order pages first. This enables compaction to work properly. [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Fix lockdep issue in ion_page_poolRebecca Schultz Zavin2013-12-141-2/+3
| | | | | | | | | | | Currently the mutex is held while kmalloc is called, under a low memory condition this might trigger the shrinker which also takes this mutex. Refactor so the mutex is not held during allocation. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Fix several issues with page poolRebecca Schultz Zavin2013-12-143-33/+65
| | | | | | | | | | | | 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 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* gpu: ion: Modify gfp flags in ion_system_heapRebecca Schultz Zavin2013-12-141-7/+18
| | | | | | | | | | | | 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. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com> [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
OpenPOWER on IntegriCloud