mm/memcg: Remove obsolete memcg_free_kmem()
Subsystems (3)
PATCH v2 1/1 mm/memcg: Remove obsolete memcg_free_kmem()
Since commit d648bcc7fe65 ("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().
--- mm/memcontrol.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
mm/memcontrol.c +3 -11
@@ -3656,13 +3656,6 @@ static void memcg_offline_kmem(struct mem_cgroup *memcg) memcg_free_cache_id(kmemcg_id); } - -static void memcg_free_kmem (struct mem_cgroup *memcg) -{ -/* css_alloc() failed, offlining didn't happen */ -if (unlikely (memcg->kmem_state ==KMEM_ONLINE )) -memcg_offline_kmem (memcg); -}#else static int memcg_online_kmem (struct mem_cgroup *memcg) {
@@ -3671,9 +3664,6 @@ static int memcg_online_kmem(struct mem_cgroup *memcg)static void memcg_offline_kmem (struct mem_cgroup *memcg) { } -static void memcg_free_kmem (struct mem_cgroup *memcg) -{ -}#endif /* CONFIG_MEMCG_KMEM */ static int memcg_update_kmem_max(struct mem_cgroup *memcg,
@@ -5308,7 +5298,9 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)cancel_work_sync (&memcg->high_work);mem_cgroup_remove_from_trees (memcg);free_shrinker_info (memcg); -memcg_free_kmem (memcg); + +/* Need to offline kmem if online_css() fails */ +memcg_offline_kmem (memcg);mem_cgroup_free (memcg); }
Signature · 1 line
2.18.1
Quoted 9 lines · Waiman Long
Since commit
d648bcc7fe65("mm: kmem: makememcg_kmem_enabled()irreversible"), the only thingmemcg_free_kmem()does is to callmemcg_offline_kmem()when the memcg is still online which can happen whenonline_css()fails due to-ENOMEM. However, the namememcg_free_kmem()is confusing and it is more clear and straight forward to callmemcg_offline_kmem()directly frommem_cgroup_css_free().Suggested-by Roman Gushchin <[email protected]>Signed-off-by Waiman Long <[email protected]>
Thanks, Waiman!
Quoted 10 lines · Waiman Long
Since commit
d648bcc7fe65("mm: kmem: makememcg_kmem_enabled()irreversible"), the only thingmemcg_free_kmem()does is to callmemcg_offline_kmem()when the memcg is still online which can happen whenonline_css()fails due to-ENOMEM. However, the namememcg_free_kmem()is confusing and it is more clear and straight forward to callmemcg_offline_kmem()directly frommem_cgroup_css_free().Suggested-by Roman Gushchin <[email protected]>Signed-off-by Waiman Long <[email protected]>
Quoted 9 lines · Waiman Long
Since commit
d648bcc7fe65("mm: kmem: makememcg_kmem_enabled()irreversible"), the only thingmemcg_free_kmem()does is to callmemcg_offline_kmem()when the memcg is still online which can happen whenonline_css()fails due to-ENOMEM. However, the namememcg_free_kmem()is confusing and it is more clear and straight forward to callmemcg_offline_kmem()directly frommem_cgroup_css_free().Suggested-by Roman Gushchin <[email protected]>Signed-off-by Waiman Long <[email protected]>
Signature · 1 line
Aaron Tomlin