diff options
-rw-r--r-- | kernel/taskstats.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 5d6a8c54ee85..9aeee511a463 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -237,14 +237,17 @@ static int fill_tgid(pid_t tgid, struct task_struct *tgidtsk, | |||
237 | } else | 237 | } else |
238 | get_task_struct(first); | 238 | get_task_struct(first); |
239 | 239 | ||
240 | /* Start with stats from dead tasks */ | ||
241 | spin_lock_irqsave(&first->signal->stats_lock, flags); | ||
242 | if (first->signal->stats) | ||
243 | memcpy(stats, first->signal->stats, sizeof(*stats)); | ||
244 | spin_unlock_irqrestore(&first->signal->stats_lock, flags); | ||
245 | 240 | ||
246 | tsk = first; | 241 | tsk = first; |
247 | read_lock(&tasklist_lock); | 242 | read_lock(&tasklist_lock); |
243 | /* Start with stats from dead tasks */ | ||
244 | if (first->signal) { | ||
245 | spin_lock_irqsave(&first->signal->stats_lock, flags); | ||
246 | if (first->signal->stats) | ||
247 | memcpy(stats, first->signal->stats, sizeof(*stats)); | ||
248 | spin_unlock_irqrestore(&first->signal->stats_lock, flags); | ||
249 | } | ||
250 | |||
248 | do { | 251 | do { |
249 | if (tsk->exit_state == EXIT_ZOMBIE && thread_group_leader(tsk)) | 252 | if (tsk->exit_state == EXIT_ZOMBIE && thread_group_leader(tsk)) |
250 | continue; | 253 | continue; |
@@ -264,7 +267,7 @@ static int fill_tgid(pid_t tgid, struct task_struct *tgidtsk, | |||
264 | * Accounting subsytems can also add calls here to modify | 267 | * Accounting subsytems can also add calls here to modify |
265 | * fields of taskstats. | 268 | * fields of taskstats. |
266 | */ | 269 | */ |
267 | 270 | put_task_struct(first); | |
268 | return 0; | 271 | return 0; |
269 | } | 272 | } |
270 | 273 | ||