diff options
author | Oleg Nesterov <oleg@redhat.com> | 2010-05-26 17:43:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:47 -0400 |
commit | b3ac022cb9dc5883505a88b159d1b240ad1ef405 (patch) | |
tree | bffa035303cbe3c5bde048ac3d3154fb57059e2d /include/linux/sched.h | |
parent | dd98acf74762764fbc4382a1d9a244f11a2658cc (diff) |
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>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index ccd2d1500720..f118809c953f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -527,8 +527,8 @@ struct thread_group_cputimer { | |||
527 | */ | 527 | */ |
528 | struct signal_struct { | 528 | struct signal_struct { |
529 | atomic_t sigcnt; | 529 | atomic_t sigcnt; |
530 | atomic_t count; | ||
531 | atomic_t live; | 530 | atomic_t live; |
531 | int nr_threads; | ||
532 | 532 | ||
533 | wait_queue_head_t wait_chldexit; /* for wait4() */ | 533 | wait_queue_head_t wait_chldexit; /* for wait4() */ |
534 | 534 | ||
@@ -2149,7 +2149,7 @@ extern bool current_is_single_threaded(void); | |||
2149 | 2149 | ||
2150 | static inline int get_nr_threads(struct task_struct *tsk) | 2150 | static inline int get_nr_threads(struct task_struct *tsk) |
2151 | { | 2151 | { |
2152 | return atomic_read(&tsk->signal->count); | 2152 | return tsk->signal->nr_threads; |
2153 | } | 2153 | } |
2154 | 2154 | ||
2155 | /* de_thread depends on thread_group_leader not being a pid based check */ | 2155 | /* de_thread depends on thread_group_leader not being a pid based check */ |