diff options
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index faad98e6d17d..4f71219cc53e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1149,17 +1149,23 @@ struct lruvec *mem_cgroup_lru_move_lists(struct zone *zone, * Checks whether given mem is same or in the root_mem_cgroup's * hierarchy subtree */ -static bool mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg, - struct mem_cgroup *memcg) +bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg, + struct mem_cgroup *memcg) { - bool ret; - if (root_memcg == memcg) return true; if (!root_memcg->use_hierarchy) return false; + return css_is_ancestor(&memcg->css, &root_memcg->css); +} + +static bool mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg, + struct mem_cgroup *memcg) +{ + bool ret; + rcu_read_lock(); - ret = css_is_ancestor(&memcg->css, &root_memcg->css); + ret = __mem_cgroup_same_or_subtree(root_memcg, memcg); rcu_read_unlock(); return ret; } |