threadgroup: rename signal->threadgroup_fork_lock to ->group_rwsem
Make the following renames to prepare for extension of threadgroup locking. * s/signal->threadgroup_fork_lock/signal->group_rwsem/ * s/threadgroup_fork_read_lock()/threadgroup_change_begin()/ * s/threadgroup_fork_read_unlock()/threadgroup_change_end()/ * s/threadgroup_fork_write_lock()/threadgroup_lock()/ * s/threadgroup_fork_write_unlock()/threadgroup_unlock()/ This patch doesn't cause any behavior change. -v2: Rename threadgroup_change_done() to threadgroup_change_end() per KAMEZAWA's suggestion. Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Paul Menage <paul@paulmenage.org>
This commit is contained in:
@@ -2003,8 +2003,8 @@ static int css_set_prefetch(struct cgroup *cgrp, struct css_set *cg,
|
||||
* @cgrp: the cgroup to attach to
|
||||
* @leader: the threadgroup leader task_struct of the group to be attached
|
||||
*
|
||||
* Call holding cgroup_mutex and the threadgroup_fork_lock of the leader. Will
|
||||
* take task_lock of each thread in leader's threadgroup individually in turn.
|
||||
* Call holding cgroup_mutex and the group_rwsem of the leader. Will take
|
||||
* task_lock of each thread in leader's threadgroup individually in turn.
|
||||
*/
|
||||
int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
|
||||
{
|
||||
@@ -2030,8 +2030,8 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
|
||||
* step 0: in order to do expensive, possibly blocking operations for
|
||||
* every thread, we cannot iterate the thread group list, since it needs
|
||||
* rcu or tasklist locked. instead, build an array of all threads in the
|
||||
* group - threadgroup_fork_lock prevents new threads from appearing,
|
||||
* and if threads exit, this will just be an over-estimate.
|
||||
* group - group_rwsem prevents new threads from appearing, and if
|
||||
* threads exit, this will just be an over-estimate.
|
||||
*/
|
||||
group_size = get_nr_threads(leader);
|
||||
/* flex_array supports very large thread-groups better than kmalloc. */
|
||||
@@ -2249,7 +2249,6 @@ static int attach_task_by_pid(struct cgroup *cgrp, u64 pid, bool threadgroup)
|
||||
cgroup_unlock();
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
/*
|
||||
* even if we're attaching all tasks in the thread group, we
|
||||
* only need to check permissions on one of them.
|
||||
@@ -2273,9 +2272,9 @@ static int attach_task_by_pid(struct cgroup *cgrp, u64 pid, bool threadgroup)
|
||||
}
|
||||
|
||||
if (threadgroup) {
|
||||
threadgroup_fork_write_lock(tsk);
|
||||
threadgroup_lock(tsk);
|
||||
ret = cgroup_attach_proc(cgrp, tsk);
|
||||
threadgroup_fork_write_unlock(tsk);
|
||||
threadgroup_unlock(tsk);
|
||||
} else {
|
||||
ret = cgroup_attach_task(cgrp, tsk);
|
||||
}
|
||||
|
@@ -972,7 +972,7 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
|
||||
sched_autogroup_fork(sig);
|
||||
|
||||
#ifdef CONFIG_CGROUPS
|
||||
init_rwsem(&sig->threadgroup_fork_lock);
|
||||
init_rwsem(&sig->group_rwsem);
|
||||
#endif
|
||||
|
||||
sig->oom_adj = current->signal->oom_adj;
|
||||
@@ -1157,7 +1157,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
||||
p->io_context = NULL;
|
||||
p->audit_context = NULL;
|
||||
if (clone_flags & CLONE_THREAD)
|
||||
threadgroup_fork_read_lock(current);
|
||||
threadgroup_change_begin(current);
|
||||
cgroup_fork(p);
|
||||
#ifdef CONFIG_NUMA
|
||||
p->mempolicy = mpol_dup(p->mempolicy);
|
||||
@@ -1372,7 +1372,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
||||
proc_fork_connector(p);
|
||||
cgroup_post_fork(p);
|
||||
if (clone_flags & CLONE_THREAD)
|
||||
threadgroup_fork_read_unlock(current);
|
||||
threadgroup_change_end(current);
|
||||
perf_event_fork(p);
|
||||
return p;
|
||||
|
||||
@@ -1407,7 +1407,7 @@ bad_fork_cleanup_policy:
|
||||
bad_fork_cleanup_cgroup:
|
||||
#endif
|
||||
if (clone_flags & CLONE_THREAD)
|
||||
threadgroup_fork_read_unlock(current);
|
||||
threadgroup_change_end(current);
|
||||
cgroup_exit(p, cgroup_callbacks_done);
|
||||
delayacct_tsk_free(p);
|
||||
module_put(task_thread_info(p)->exec_domain->module);
|
||||
|
Reference in New Issue
Block a user