From: Jian Zhang zhangjian210@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8NC0E
-------------------------------
In Ascend, we use tmp hugepage and disable OOM-killer, when we cause a OOM, and after some time, the memory is enough for process, the process will not return to run normal. In this case, we must use oom recover to let the process run.
Signed-off-by: Jian Zhang zhangjian210@huawei.com --- mm/memcontrol.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 08af3c8df6f3..e1e79339dbd2 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3154,12 +3154,22 @@ void __memcg_kmem_uncharge_page(struct page *page, int order) struct folio *folio = page_folio(page); struct obj_cgroup *objcg; unsigned int nr_pages = 1 << order; +#ifdef CONFIG_ASCEND_OOM + struct mem_cgroup *memcg; +#endif
if (!folio_memcg_kmem(folio)) return;
objcg = __folio_objcg(folio); obj_cgroup_uncharge_pages(objcg, nr_pages); +#ifdef CONFIG_ASCEND_OOM + memcg = get_mem_cgroup_from_objcg(objcg); + if (!mem_cgroup_is_root(memcg)) + memcg_oom_recover(memcg); + css_put(&memcg->css); +#endif + folio->memcg_data = 0; obj_cgroup_put(objcg); }