Commit 3e8bcb36 authored by Liu Shixin's avatar Liu Shixin
Browse files

mm/memcg: introduce memcg_has_children to check memcg

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


CVE: NA

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

Re-introduce memcg_has_children to check whether a memcg is leaf.

Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
parent abe1a624
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1220,6 +1220,17 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
int memcg_get_swap_type(struct folio *folio);
void memcg_remove_swapfile(int type);

/* Test whether @memcg has children, dead or alive. */
static inline bool memcg_has_children(struct mem_cgroup *memcg)
{
	bool ret;

	rcu_read_lock();
	ret = css_next_child(NULL, &memcg->css);
	rcu_read_unlock();
	return ret;
}

#else /* CONFIG_MEMCG */

#define MEM_CGROUP_ID_SHIFT	0