[Devel] [PATCH RHEL8 COMMIT] memcg: Fix missing memcg->cache charges during page
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Oct 14 15:38:33 MSK 2020
The commit is pushed to "branch-rh8-4.18.0-193.6.3.vz8.4.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-193.6.3.vz8.4.12
------>
commit 6fc29b4923f41ef5597536d5a590ef83c59d26a5
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date: Wed Oct 14 15:38:33 2020 +0300
memcg: Fix missing memcg->cache charges during page
migration #PSBM-120653
Date: Fri, 9 Oct 2020 12:52:03 +0300
Message-Id: <20201009095203.12533-1-aryabinin at virtuozzo.com>
Since 44b7a8d33d66 ("mm: memcontrol: do not uncharge old page in
page cache replacement") the mem_cgroup_migrate() charges newpage,
but the ->cache charge is missing here. Add it to fix negative ->cache
values, which leads to WARNING like bellow and softlockups.
WARNING: CPU: 14 PID: 1372 at mm/page_counter.c:62 page_counter_cancel+0x26/0x30
Call Trace:
page_counter_uncharge+0x1d/0x30
uncharge_batch+0x25c/0x2e0
mem_cgroup_uncharge_list+0x64/0x90
release_pages+0x33e/0x3c0
__pagevec_release+0x1b/0x40
truncate_inode_pages_range+0x358/0x8b0
ext4_evict_inode+0x167/0x580 [ext4]
evict+0xd2/0x1a0
do_unlinkat+0x250/0x2e0
do_syscall_64+0x5b/0x1a0
entry_SYSCALL_64_after_hwframe+0x65/0xca
https://jira.sw.ru/browse/PSBM-120653
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
mm/memcontrol.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index df70c3bdd444..134cb27307f2 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6867,6 +6867,8 @@ void mem_cgroup_migrate(struct page *oldpage, struct page *newpage)
page_counter_charge(&memcg->memory, nr_pages);
if (do_memsw_account())
page_counter_charge(&memcg->memsw, nr_pages);
+ if (!PageAnon(newpage) && !PageSwapBacked(newpage))
+ page_counter_charge(&memcg->cache, nr_pages);
css_get_many(&memcg->css, nr_pages);
commit_charge(newpage, memcg, false);
More information about the Devel
mailing list