On Fri, Oct 01, 2021 at 03:09:37PM -0400, Waiman Long wrote:I just realize that memcg_online_kmem() is called at css_create(). So yes, if css_online() fails (i.e. ENOMEM), we will need to do memcg_offline_kmem().
Since commit d648bcc7fe65 ("mm: kmem: make memcg_kmem_enabled()Hm, is it true? What if online_css() fails?
irreversible"), the only thing memcg_free_kmem() does is to call
memcg_offline_kmem() when the memcg is still online. However,
memcg_offline_kmem() is only called from mem_cgroup_css_free() which
cannot be reached if the memcg hasn't been offlined first.
As thisIt looks like we can just use memcg_offline_kmem() instead of
function now serves no purpose, we should just remove it.
memcg_free_kmem().