提交 94c749a3 编写于 作者: L Liu Shixin 提交者: Zheng Zengkai

mm/dynamic_hugetlb: use mem_cgroup_force_empty to reclaim pages

hulk inclusion
category: bugfix
bugzilla: 46904 https://gitee.com/openeuler/kernel/issues/I4Y0XO

--------------------------------

When all processes in the memory cgroup are finished, some memory may still be
occupied such as file cache. Use mem_cgroup_force_empty to reclaim these pages
that charged in the memory cgroup before merging all pages.
Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 c3aad494
......@@ -1258,6 +1258,8 @@ static inline bool memcg_has_children(struct mem_cgroup *memcg)
return ret;
}
int mem_cgroup_force_empty(struct mem_cgroup *memcg);
#else /* CONFIG_MEMCG */
#define MEM_CGROUP_ID_SHIFT 0
......
......@@ -849,6 +849,12 @@ int hugetlb_pool_destroy(struct cgroup *cgrp)
if (!hpool || hpool->attach_memcg != memcg)
return 0;
/*
* Even if no process exists in the memory cgroup, some pages may still
* be occupied. Release these pages before merging them.
*/
mem_cgroup_force_empty(hpool->attach_memcg);
ret = hugetlb_pool_merge_all_pages(hpool);
if (ret)
return -ENOMEM;
......
......@@ -3407,7 +3407,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
*
* Caller is responsible for holding css reference for memcg.
*/
static int mem_cgroup_force_empty(struct mem_cgroup *memcg)
int mem_cgroup_force_empty(struct mem_cgroup *memcg)
{
int nr_retries = MAX_RECLAIM_RETRIES;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册