Skip to content

Commit 38d4ef4

Browse files
Waiman-Longtorvalds
authored andcommitted
mm/memcg: remove obsolete memcg_free_kmem()
Since commit d648bcc ("mm: kmem: make memcg_kmem_enabled() irreversible"), the only thing memcg_free_kmem() does is to call memcg_offline_kmem() when the memcg is still online which can happen when online_css() fails due to -ENOMEM. However, the name memcg_free_kmem() is confusing and it is more clear and straight forward to call memcg_offline_kmem() directly from mem_cgroup_css_free(). Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Waiman Long <[email protected]> Suggested-by: Roman Gushchin <[email protected]> Reviewed-by: Aaron Tomlin <[email protected]> Reviewed-by: Shakeel Butt <[email protected]> Reviewed-by: Roman Gushchin <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Vladimir Davydov <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Muchun Song <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent fd25a9e commit 38d4ef4

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

mm/memcontrol.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3704,13 +3704,6 @@ static void memcg_offline_kmem(struct mem_cgroup *memcg)
37043704

37053705
memcg_free_cache_id(kmemcg_id);
37063706
}
3707-
3708-
static void memcg_free_kmem(struct mem_cgroup *memcg)
3709-
{
3710-
/* css_alloc() failed, offlining didn't happen */
3711-
if (unlikely(memcg->kmem_state == KMEM_ONLINE))
3712-
memcg_offline_kmem(memcg);
3713-
}
37143707
#else
37153708
static int memcg_online_kmem(struct mem_cgroup *memcg)
37163709
{
@@ -3719,9 +3712,6 @@ static int memcg_online_kmem(struct mem_cgroup *memcg)
37193712
static void memcg_offline_kmem(struct mem_cgroup *memcg)
37203713
{
37213714
}
3722-
static void memcg_free_kmem(struct mem_cgroup *memcg)
3723-
{
3724-
}
37253715
#endif /* CONFIG_MEMCG_KMEM */
37263716

37273717
static int memcg_update_kmem_max(struct mem_cgroup *memcg,
@@ -5356,7 +5346,9 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
53565346
cancel_work_sync(&memcg->high_work);
53575347
mem_cgroup_remove_from_trees(memcg);
53585348
free_shrinker_info(memcg);
5359-
memcg_free_kmem(memcg);
5349+
5350+
/* Need to offline kmem if online_css() fails */
5351+
memcg_offline_kmem(memcg);
53605352
mem_cgroup_free(memcg);
53615353
}
53625354

0 commit comments

Comments
 (0)