mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 06:33:19 -04:00
ion: Conditionally compile page pool refill code
Compile the page pool refill code only when CONFIG_ION_POOL_AUTO_REFILL is enabled. Change-Id: Ia4024f3d6eec08769d837fbc3f81f778cdd29bff Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
89f1fad7ce
commit
3c29b7a199
3 changed files with 59 additions and 31 deletions
|
|
@ -69,7 +69,7 @@ config ION_DEFER_FREE_NO_SCHED_IDLE
|
|||
|
||||
config ION_POOL_AUTO_REFILL
|
||||
bool "Refill the ION heap pools automatically"
|
||||
depends on ION
|
||||
depends on ION && QGKI
|
||||
help
|
||||
Choose this option to refill the ION system heap pools (non-secure)
|
||||
automatically when the pool pages count becomes lower than a set low mark.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,37 @@
|
|||
#include "msm_ion_priv.h"
|
||||
#include "ion_page_pool.h"
|
||||
|
||||
static inline struct page *ion_page_pool_alloc_pages(struct ion_page_pool *pool)
|
||||
{
|
||||
if (fatal_signal_pending(current))
|
||||
return NULL;
|
||||
return alloc_pages(pool->gfp_mask, pool->order);
|
||||
}
|
||||
|
||||
static void ion_page_pool_free_pages(struct ion_page_pool *pool,
|
||||
struct page *page)
|
||||
{
|
||||
__free_pages(page, pool->order);
|
||||
}
|
||||
|
||||
static void ion_page_pool_add(struct ion_page_pool *pool, struct page *page)
|
||||
{
|
||||
mutex_lock(&pool->mutex);
|
||||
if (PageHighMem(page)) {
|
||||
list_add_tail(&page->lru, &pool->high_items);
|
||||
pool->high_count++;
|
||||
} else {
|
||||
list_add_tail(&page->lru, &pool->low_items);
|
||||
pool->low_count++;
|
||||
}
|
||||
|
||||
atomic_inc(&pool->count);
|
||||
mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE,
|
||||
(1 << (PAGE_SHIFT + pool->order)));
|
||||
mutex_unlock(&pool->mutex);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ION_POOL_AUTO_REFILL
|
||||
/* do a simple check to see if we are in any low memory situation */
|
||||
static bool pool_refill_ok(struct ion_page_pool *pool)
|
||||
{
|
||||
|
|
@ -48,36 +79,6 @@ static bool pool_refill_ok(struct ion_page_pool *pool)
|
|||
return true;
|
||||
}
|
||||
|
||||
static inline struct page *ion_page_pool_alloc_pages(struct ion_page_pool *pool)
|
||||
{
|
||||
if (fatal_signal_pending(current))
|
||||
return NULL;
|
||||
return alloc_pages(pool->gfp_mask, pool->order);
|
||||
}
|
||||
|
||||
static void ion_page_pool_free_pages(struct ion_page_pool *pool,
|
||||
struct page *page)
|
||||
{
|
||||
__free_pages(page, pool->order);
|
||||
}
|
||||
|
||||
static void ion_page_pool_add(struct ion_page_pool *pool, struct page *page)
|
||||
{
|
||||
mutex_lock(&pool->mutex);
|
||||
if (PageHighMem(page)) {
|
||||
list_add_tail(&page->lru, &pool->high_items);
|
||||
pool->high_count++;
|
||||
} else {
|
||||
list_add_tail(&page->lru, &pool->low_items);
|
||||
pool->low_count++;
|
||||
}
|
||||
|
||||
atomic_inc(&pool->count);
|
||||
mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE,
|
||||
(1 << (PAGE_SHIFT + pool->order)));
|
||||
mutex_unlock(&pool->mutex);
|
||||
}
|
||||
|
||||
void ion_page_pool_refill(struct ion_page_pool *pool)
|
||||
{
|
||||
struct page *page;
|
||||
|
|
@ -99,6 +100,7 @@ void ion_page_pool_refill(struct ion_page_pool *pool)
|
|||
ion_page_pool_add(pool, page);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_ION_PAGE_POOL_REFILL */
|
||||
|
||||
static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ size_t ion_system_heap_secure_page_pool_total(struct ion_heap *heap, int vmid);
|
|||
int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
|
||||
int nr_to_scan);
|
||||
|
||||
#ifdef CONFIG_ION_POOL_AUTO_REFILL
|
||||
void ion_page_pool_refill(struct ion_page_pool *pool);
|
||||
|
||||
static __always_inline int get_pool_fillmark(struct ion_page_pool *pool)
|
||||
|
|
@ -113,4 +114,29 @@ static __always_inline bool pool_fillmark_reached(struct ion_page_pool *pool)
|
|||
{
|
||||
return atomic_read(&pool->count) >= get_pool_fillmark(pool);
|
||||
}
|
||||
#else
|
||||
static inline void ion_page_pool_refill(struct ion_page_pool *pool)
|
||||
{
|
||||
}
|
||||
|
||||
static __always_inline int get_pool_fillmark(struct ion_page_pool *pool)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __always_inline int get_pool_lowmark(struct ion_page_pool *pool)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __always_inline bool pool_count_below_lowmark(struct ion_page_pool *pool)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static __always_inline bool pool_fillmark_reached(struct ion_page_pool *pool)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif /* CONFIG_ION_POOL_AUTO_REFILL */
|
||||
#endif /* _ION_PAGE_POOL_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue