The following patch will add memcg_shrinker_deferred which could be protected by the same mutex, rename it to a more common name. Signed-off-by: Yang Shi <shy828301@xxxxxxxxx> --- mm/memcontrol.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 29459a6ce1c7..19e41684c96b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -395,7 +395,7 @@ EXPORT_SYMBOL(memcg_kmem_enabled_key); #endif static int memcg_shrinker_map_size; -static DEFINE_MUTEX(memcg_shrinker_map_mutex); +static DEFINE_MUTEX(memcg_shrinker_mutex); static void memcg_free_shrinker_map_rcu(struct rcu_head *head) { @@ -408,7 +408,7 @@ static int memcg_expand_one_shrinker_map(struct mem_cgroup *memcg, struct memcg_shrinker_map *new, *old; int nid; - lockdep_assert_held(&memcg_shrinker_map_mutex); + lockdep_assert_held(&memcg_shrinker_mutex); for_each_node(nid) { old = rcu_dereference_protected( @@ -458,7 +458,7 @@ static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg) if (mem_cgroup_is_root(memcg)) return 0; - mutex_lock(&memcg_shrinker_map_mutex); + mutex_lock(&memcg_shrinker_mutex); size = memcg_shrinker_map_size; for_each_node(nid) { map = kvzalloc_node(sizeof(*map) + size, GFP_KERNEL, nid); @@ -469,7 +469,7 @@ static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg) } rcu_assign_pointer(memcg->nodeinfo[nid]->shrinker_map, map); } - mutex_unlock(&memcg_shrinker_map_mutex); + mutex_unlock(&memcg_shrinker_mutex); return ret; } @@ -484,7 +484,7 @@ int memcg_expand_shrinker_maps(int new_id) if (size <= old_size) return 0; - mutex_lock(&memcg_shrinker_map_mutex); + mutex_lock(&memcg_shrinker_mutex); if (!root_mem_cgroup) goto unlock; @@ -500,7 +500,7 @@ int memcg_expand_shrinker_maps(int new_id) unlock: if (!ret) memcg_shrinker_map_size = size; - mutex_unlock(&memcg_shrinker_map_mutex); + mutex_unlock(&memcg_shrinker_mutex); return ret; } -- 2.26.2