[Devel] [PATCH rh7 3/3] mm/memory: Don't charged cowed private pages as cache.

Andrey Ryabinin aryabinin at virtuozzo.com
Tue Jun 26 19:03:54 MSK 2018


Cowed page on private mapping is considiered as anonymous page.
Charging it as a cache page is wrong and leads to leaking ->cache
increments.

Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index f10ad9ef5135..af8dbb6ffa56 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3024,7 +3024,7 @@ static int do_cow_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 	if (!new_page)
 		return VM_FAULT_OOM;
 
-	if (mem_cgroup_try_charge_cache(new_page, mm, GFP_KERNEL, &memcg)) {
+	if (mem_cgroup_try_charge(new_page, mm, GFP_KERNEL, &memcg)) {
 		page_cache_release(new_page);
 		return VM_FAULT_OOM;
 	}
@@ -3054,7 +3054,7 @@ static int do_cow_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 	page_cache_release(fault_page);
 	return ret;
 uncharge_out:
-	mem_cgroup_cancel_cache_charge(new_page, memcg);
+	mem_cgroup_cancel_charge(new_page, memcg);
 	page_cache_release(new_page);
 	return ret;
 }
-- 
2.16.4



More information about the Devel mailing list