aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/android/ion/ion_page_pool.c
AgeCommit message (Collapse)Author
2015-10-12drivers/staging: make android ion_page_pool.c explicitly non-modularPaul Gortmaker
The Kconfig currently controlling compilation of this code is: drivers/staging/android/ion/Kconfig:menuconfig ION drivers/staging/android/ion/Kconfig: bool "Ion Memory Manager" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Arve Hjønnevåg" <arve@android.com> Cc: Riley Andrews <riandrews@android.com> Cc: devel@driverdev.osuosl.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14staging: ion: shrink page-pool by page unitGioh Kim
This patch shrink page-pool by page unit. The system shrinker calls ion_heap_shrink_count() to get nr_to_scan, and pass it to ion_heap_shrink_scan(). The problem is the return value of ion_heap_shrink_count() is the number of pages but ion_system_heap_shrink(), which is called by ion_heap_shrink_scan(), gets the number of chunk. The main root of this is that ion_page_pool_shrink() returns page count via ion_page_pool_total() if it have to check pool size. But it frees chunks of pages if it have to free pools. This patch first fix ion_page_pool_shrink() to count only pages, not chunks. And then ion_system_heap_shrink() to work on pages. Signed-off-by: Gioh Kim <gioh.kim@lge.com> Reviewed-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-23staging: android: Assign bool to trueTapasweni Pathak
high is a bool type variable. bool variable should be assigned true, false not 1 or 0. This patch assigns high to true, replacing 1. Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-29staging: ion: shrink highmem pages on kswapdHeesub Shin
ION system heap keeps pages in its pool for better performance. When the system is under memory pressure, slab shrinker calls the callback registered and then the pages pooled get freed. When the shrinker is called, it checks gfp_mask and determines whether the pages from highmem need to be freed or the pages from lowmem. Usually, slab shrinker is invoked on kswapd context which gfp_mask is always GFP_KERNEL, so only lowmem pages are released on kswapd context. This means that highmem pages in the pool are never reclaimed until direct reclaim occurs. This can be problematic when the page pool holds excessive amounts of highmem. For now, the shrinker callback cannot know exactly which zone should be targeted for reclamation, as enough information are not passed to. Thus, it makes sense to shrink both lowmem and highmem zone on kswapd context. Reported-by: Wonseo Choi <wonseo.choi@samsung.com> Signed-off-by: Heesub Shin <heesub.shin@samsung.com> Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org> Tested-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-29staging: ion: use compound pages on high order pages for system heapHeesub Shin
Using compound pages relieves burden on tracking the meta information which are currently stored in page_info. Signed-off-by: Heesub Shin <heesub.shin@samsung.com> Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org> Tested-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-29staging: ion: remove struct ion_page_pool_itemHeesub Shin
The page pool uses an internal data structure, ion_page_pool_item, for wrapping pooled pages and constructing a list. As the struct page already provides ways for doing exactly the same thing, we do not need to reinvent the wheel. This commit removes the data structure and slab allocations for it. Signed-off-by: Heesub Shin <heesub.shin@samsung.com> Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org> Tested-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-29staging: ion: simplify ion_page_pool_total()Heesub Shin
ion_page_pool_total() returns the total number of pages in the pool. Depending on the argument passed, it counts highmem pages in or not. This commit simplifies the code lines for better readability. Signed-off-by: Heesub Shin <heesub.shin@samsung.com> Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org> Tested-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-29staging: ion: tidy up a bitHeesub Shin
For aesthetics and readability, rename goto labels, remove useless code lines, and clarify function return type. Signed-off-by: Heesub Shin <heesub.shin@samsung.com> Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org> Tested-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-18staging: ion: Move shrinker out of heapsColin Cross
Every heap that uses deferred frees is going to need a shrinker to shrink the freelist under memory pressure. Rather than requiring each heap to implement a shrinker, automatically register a shrinker if the deferred free flag is set. The system heap also needs to shrink its page pools, so add a shrink function to the heap ops that will be called after shrinking the freelists. Cc: Colin Cross <ccross@android.com> Cc: Android Kernel Team <kernel-team@android.com> Signed-off-by: Colin Cross <ccross@android.com> [jstultz: Resolved big conflicts with the shrinker api change. Also minor commit subject tweak.] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-14ion: Cleanup whitespace issues and other checkpatch problemsJohn Stultz
Just some simple cleanups to address whitespace issues and other issues found w/ checkpatch. Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-14ion: fix sparse warningsColin Cross
Fix sparse warnings in ion. 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>
2013-12-14ion: free low memory from page pools firstColin Cross
When the shrinkers are called with GFP_HIGH free low memory first, it is more important to have free than high memory. 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>
2013-12-14ion: fix dma APIsColin Cross
__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>
2013-12-14gpu: 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> [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>
2013-12-14gpu: 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. 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>
2013-12-14gpu: ion: Fix bug in ion shrinkerRebecca Schultz Zavin
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>
2013-12-14gpu: ion: Switch to using a single shrink functionRebecca Schultz Zavin
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>
2013-12-14gpu: ion: Fix lockdep issue in ion_page_poolRebecca Schultz Zavin
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>
2013-12-14gpu: 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 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>
2013-12-14gpu: ion: Add ion_page_pool.Rebecca Schultz Zavin
This patch adds a new utility heaps can use to manage memory. In the past we have found it can be very expensive to manage the caches when allocating memory, but it is imposible to know whether a previous user of a given memory allocation had a cached mapping. This patch adds the ability to store a pool of pages that were previously used uncached so that cache maintenance only need be done when growing this pool. The pool also contains a shrinker so memory from the pool can be recovered in low memory conditions. 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>