Loading drivers/staging/android/ion/heaps/Kconfig +1 −1 Original line number Diff line number Diff line Loading @@ -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. Loading drivers/staging/android/ion/heaps/ion_page_pool.c +32 −30 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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; Loading @@ -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) { Loading drivers/staging/android/ion/heaps/ion_page_pool.h +26 −0 Original line number Diff line number Diff line Loading @@ -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) Loading @@ -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
drivers/staging/android/ion/heaps/Kconfig +1 −1 Original line number Diff line number Diff line Loading @@ -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. Loading
drivers/staging/android/ion/heaps/ion_page_pool.c +32 −30 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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; Loading @@ -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) { Loading
drivers/staging/android/ion/heaps/ion_page_pool.h +26 −0 Original line number Diff line number Diff line Loading @@ -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) Loading @@ -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 */