• Tejun Heo's avatar
    cgroup: kill cgroup_subsys->__DEPRECATED_clear_css_refs · ed957793
    Tejun Heo authored
    2ef37d3f ("memcg: Simplify mem_cgroup_force_empty_list error
    handling") removed the last user of __DEPRECATED_clear_css_refs.  This
    patch removes __DEPRECATED_clear_css_refs and mechanisms to support
    it.
    
    * Conditionals dependent on __DEPRECATED_clear_css_refs removed.
    
    * cgroup_clear_css_refs() can no longer fail.  All that needs to be
      done are deactivating refcnts, setting CSS_REMOVED and putting the
      base reference on each css.  Remove cgroup_clear_css_refs() and the
      failure path, and open-code the loops into cgroup_rmdir().
    
    This patch keeps the two for_each_subsys() loops separate while open
    coding them.  They can be merged now but there are scheduled changes
    which need them to be separate, so keep them separate to reduce the
    amount of churn.
    
    local_irq_save/restore() from cgroup_clear_css_refs() are replaced
    with local_irq_disable/enable() for simplicity.  This is safe as
    cgroup_rmdir() is always called with IRQ enabled.  Note that this IRQ
    switching is necessary to ensure that css_tryget() isn't called from
    IRQ context on the same CPU while lower context is between CSS
    deactivation and setting CSS_REMOVED as css_tryget() would hang
    forever in such cases waiting for CSS to be re-activated or
    CSS_REMOVED set.  This will go away soon.
    
    v2: cgroup_call_pre_destroy() removal dropped per Michal.  Commit
        message updated to explain local_irq_disable/enable() conversion.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Reviewed-by: default avatarMichal Hocko <mhocko@suse.cz>
    Reviewed-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Acked-by: default avatarLi Zefan <lizefan@huawei.com>
    ed957793
cgroup.c 142 KB