• Tejun Heo's avatar
    cgroup: implement cgroup_has_tasks() and unexport cgroup_task_count() · 07bc356e
    Tejun Heo authored
    cgroup_task_count() read-locks css_set_lock and walks all tasks to
    count them and then returns the result.  The only thing all the users
    want is determining whether the cgroup is empty or not.  This patch
    implements cgroup_has_tasks() which tests whether cgroup->cset_links
    is empty, replaces all cgroup_task_count() usages and unexports it.
    
    Note that the test isn't synchronized.  This is the same as before.
    The test has always been racy.
    
    This will help planned css_set locking update.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Acked-by: default avatarLi Zefan <lizefan@huawei.com>
    Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Balbir Singh <bsingharora@gmail.com>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    07bc356e
cpuset.c 76.8 KB