[RHEL7,COMMIT] mm/filemap: fix ->cache counter leak

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

Details

Message ID 201806281435.w5SEZb72020077@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 50749ac0f790a0cd24bb4ae855918fc7555bcc4b
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Thu Jun 28 17:35:37 2018 +0300

    mm/filemap: fix ->cache counter leak
    
    __add_to_page_cache_locked() sometimes uses
    mem_cgroup_cancel_charge() instead of mem_cgroup_cancel_cache_charge()
    which leads to leaking ->cache charge.
    
    Fixes: 2c99f211cfc5 ("mm/memcg: Don't charge anon pages as cache")
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/filemap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/filemap.c b/mm/filemap.c
index be6c37175b20..d54d508e134e 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -743,7 +743,7 @@  static int __add_to_page_cache_locked(struct page *page,
 			/* Leave page->index set: truncation relies upon it */
 			spin_unlock_irq(&mapping->tree_lock);
 			if (!huge)
-				mem_cgroup_cancel_charge(page, memcg);
+				mem_cgroup_cancel_cache_charge(page, memcg);
 			page_cache_release(page);
 		}
 		radix_tree_preload_end();