[rh7,2/3] mm/filemap: fix ->cache counter leak

Submitted by Andrey Ryabinin on June 26, 2018, 4:03 p.m.

Details

Message ID 20180626160354.22790-2-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin June 26, 2018, 4:03 p.m.
__add_to_page_cache_locked() sometimes uses
mem_cgroup_cancel_charge() instead of mem_cgroup_cancel_cache_charge()
which leads to leaking ->cache charge.

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();