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 /kernel/exit.c | |
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 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 357d443d5a00..ceffc67b564a 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -83,14 +83,10 @@ static void __exit_signal(struct task_struct *tsk) | |||
83 | struct sighand_struct *sighand; | 83 | struct sighand_struct *sighand; |
84 | struct tty_struct *uninitialized_var(tty); | 84 | struct tty_struct *uninitialized_var(tty); |
85 | 85 | ||
86 | BUG_ON(!sig); | ||
87 | BUG_ON(!atomic_read(&sig->count)); | ||
88 | |||
89 | sighand = rcu_dereference_check(tsk->sighand, | 86 | sighand = rcu_dereference_check(tsk->sighand, |
90 | rcu_read_lock_held() || | 87 | rcu_read_lock_held() || |
91 | lockdep_tasklist_lock_is_held()); | 88 | lockdep_tasklist_lock_is_held()); |
92 | spin_lock(&sighand->siglock); | 89 | spin_lock(&sighand->siglock); |
93 | atomic_dec(&sig->count); | ||
94 | 90 | ||
95 | posix_cpu_timers_exit(tsk); | 91 | posix_cpu_timers_exit(tsk); |
96 | if (group_dead) { | 92 | if (group_dead) { |
@@ -130,6 +126,7 @@ static void __exit_signal(struct task_struct *tsk) | |||
130 | sig->sum_sched_runtime += tsk->se.sum_exec_runtime; | 126 | sig->sum_sched_runtime += tsk->se.sum_exec_runtime; |
131 | } | 127 | } |
132 | 128 | ||
129 | sig->nr_threads--; | ||
133 | __unhash_process(tsk, group_dead); | 130 | __unhash_process(tsk, group_dead); |
134 | 131 | ||
135 | /* | 132 | /* |