Commit 78612d58 authored by Liu Shixin's avatar Liu Shixin
Browse files

mm/dynamic_pool: call mem_cgroup_force_empty before restore pool

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8S9BY


CVE: NA

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

Before restore pool, call mem_cgroup_force_empty to release pages.

Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
parent 63343bed
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1236,6 +1236,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
+6 −0
Original line number Diff line number Diff line
@@ -435,6 +435,12 @@ int dynamic_pool_destroy(struct cgroup *cgrp, bool *clear_css_online)
	/* A offline dpool is not allowed for allocation */
	dpool->online = false;

	/*
	 * Even if no process exists in the memory cgroup, some pages may
	 * still be occupied. Release these pages before restore pool.
	 */
	mem_cgroup_force_empty(dpool->memcg);

	BUG_ON(!dpool->ops->restore_pool);
	ret = dpool->ops->restore_pool(dpool);
	if (ret) {
+1 −1
Original line number Diff line number Diff line
@@ -3729,7 +3729,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;