mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 16:41:25 +00:00
proc: turn signal_struct->count into "int nr_threads"
No functional changes, just s/atomic_t count/int nr_threads/. With the recent changes this counter has a single user, get_nr_threads() And, none of its callers need the really accurate number of threads, not to mention each caller obviously races with fork/exit. It is only used to report this value to the user-space, except first_tid() uses it to avoid the unnecessary while_each_thread() loop in the unlikely case. It is a bit sad we need a word in struct signal_struct for this, perhaps we can change get_nr_threads() to approximate the number of threads using signal->live and kill ->nr_threads later. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
dd98acf747
commit
b3ac022cb9
4 changed files with 8 additions and 11 deletions
|
@ -877,9 +877,9 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
|
|||
if (!sig)
|
||||
return -ENOMEM;
|
||||
|
||||
atomic_set(&sig->sigcnt, 1);
|
||||
atomic_set(&sig->count, 1);
|
||||
sig->nr_threads = 1;
|
||||
atomic_set(&sig->live, 1);
|
||||
atomic_set(&sig->sigcnt, 1);
|
||||
init_waitqueue_head(&sig->wait_chldexit);
|
||||
if (clone_flags & CLONE_NEWPID)
|
||||
sig->flags |= SIGNAL_UNKILLABLE;
|
||||
|
@ -1256,9 +1256,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
|||
}
|
||||
|
||||
if (clone_flags & CLONE_THREAD) {
|
||||
atomic_inc(¤t->signal->sigcnt);
|
||||
atomic_inc(¤t->signal->count);
|
||||
current->signal->nr_threads++;
|
||||
atomic_inc(¤t->signal->live);
|
||||
atomic_inc(¤t->signal->sigcnt);
|
||||
p->group_leader = current->group_leader;
|
||||
list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue