[RHEL7,COMMIT] mm/memory: Don't charged cowed private pages as cache

Submitted by Konstantin Khorenko on June 28, 2018, 2:35 p.m.

Details

Message ID 201806281435.w5SEZcZ0020128@finist_ce7.work
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko June 28, 2018, 2:35 p.m.
The commit is pushed to "branch-rh7-3.10.0-862.3.2.vz7.61.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.3.2.vz7.61.6
------>
commit 6a1730e8e4356ea8c62b75453a901bd508319533
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Thu Jun 28 17:35:38 2018 +0300

    mm/memory: Don't charged cowed private pages as cache
    
    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@virtuozzo.com>
---
 mm/memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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;
 }