From: Jian Zhang zhangjian210@huawei.com
Signed-off-by: Jian Zhang zhangjian210@huawei.com --- mm/memcontrol.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 93fa3cb7a269..12dd1cfeb2a5 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3077,6 +3077,7 @@ int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, int order) void __memcg_kmem_uncharge_page(struct page *page, int order) { struct obj_cgroup *objcg; + struct mem_cgroup *memcg; unsigned int nr_pages = 1 << order;
if (!PageMemcgKmem(page)) @@ -3084,6 +3085,12 @@ void __memcg_kmem_uncharge_page(struct page *page, int order)
objcg = __page_objcg(page); obj_cgroup_uncharge_pages(objcg, nr_pages); + + memcg = get_mem_cgroup_from_objcg(objcg); + if (!mem_cgroup_is_root(memcg)) + memcg_oom_recover(memcg); + css_put(&memcg->css); + page->memcg_data = 0; obj_cgroup_put(objcg); }