From: Jian Zhang zhangjian210@huawei.com
ascend inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I63SDZ
-------------------------------
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 | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 8a881ab21f6c..2a31898632ce 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3150,12 +3150,23 @@ 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_FEATURES + 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_FEATURES + 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); }