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:
Oleg Nesterov
2010-05-26 14:43:24 -07:00
committed by Linus Torvalds
parent dd98acf747
commit b3ac022cb9
4 changed files with 8 additions and 11 deletions

View File

@ -527,8 +527,8 @@ struct thread_group_cputimer {
*/
struct signal_struct {
atomic_t sigcnt;
atomic_t count;
atomic_t live;
int nr_threads;
wait_queue_head_t wait_chldexit; /* for wait4() */
@ -2149,7 +2149,7 @@ extern bool current_is_single_threaded(void);
static inline int get_nr_threads(struct task_struct *tsk)
{
return atomic_read(&tsk->signal->count);
return tsk->signal->nr_threads;
}
/* de_thread depends on thread_group_leader not being a pid based check */