From ff60d1d2dbe944efa50badf6f3cb8a59500ddcd7 Mon Sep 17 00:00:00 2001 From: Vijayanand Jitta Date: Mon, 4 Mar 2019 15:37:42 +0530 Subject: [PATCH] ion: add ion pages to NR_UNRECLAIMABLE_PAGES add the ion pages allocated through system and system secure heaps to NR_UNRECLAIMABLE_PAGES memory counter. Change-Id: I4bf846fcd0454a5ba0e1cad08e9b7e882f92ceac Signed-off-by: Vijayanand Jitta [guptap@codeaurora.org: Add Kconfig entry to prevent ABI breakages in GKI] Signed-off-by: Prakash Gupta --- .../staging/android/ion/heaps/ion_system_heap.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/staging/android/ion/heaps/ion_system_heap.c b/drivers/staging/android/ion/heaps/ion_system_heap.c index 6c9bfc8ff4b5..de845a7852f9 100644 --- a/drivers/staging/android/ion/heaps/ion_system_heap.c +++ b/drivers/staging/android/ion/heaps/ion_system_heap.c @@ -153,8 +153,19 @@ void free_buffer_page(struct ion_system_heap *heap, ion_page_pool_free_immediate(pool, page); else ion_page_pool_free(pool, page); + +#ifdef CONFIG_MM_STAT_UNRECLAIMABLE_PAGES + mod_node_page_state(page_pgdat(page), NR_UNRECLAIMABLE_PAGES, + -(1 << pool->order)); +#endif } else { __free_pages(page, order); + +#ifdef CONFIG_MM_STAT_UNRECLAIMABLE_PAGES + mod_node_page_state(page_pgdat(page), NR_UNRECLAIMABLE_PAGES, + -(1 << order)); +#endif + } } @@ -314,6 +325,12 @@ static int ion_system_heap_allocate(struct ion_heap *heap, sz = (1 << info->order) * PAGE_SIZE; +#ifdef CONFIG_MM_STAT_UNRECLAIMABLE_PAGES + mod_node_page_state(page_pgdat(info->page), + NR_UNRECLAIMABLE_PAGES, + (1 << (info->order))); +#endif + if (info->from_pool) { list_add_tail(&info->list, &pages_from_pool); } else {