diff options
author | Oleg Nesterov <oleg@redhat.com> | 2014-08-13 15:20:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-08-20 03:47:18 -0400 |
commit | 1e4dda08b4c39b3d8f4a3ee7269d49e0200c8af8 (patch) | |
tree | ecd6e21e803f43c3858aa4c5e12e8f5e05784847 | |
parent | d38e83c715270cc2e137bbf6f25206c8c023896b (diff) |
sched: Change thread_group_cputime() to use for_each_thread()
Change thread_group_cputime() to use for_each_thread() instead of
buggy while_each_thread(). This also makes the pid_alive() check
unnecessary.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Frank Mayhar <fmayhar@google.com>
Cc: Frederic Weisbecker <fweisbec@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Sanjay Rao <srao@redhat.com>
Cc: Larry Woodman <lwoodman@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20140813192000.GA19327@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | kernel/sched/cputime.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 72fdf06ef865..3e52836359ba 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c | |||
@@ -294,18 +294,12 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) | |||
294 | times->sum_exec_runtime = sig->sum_sched_runtime; | 294 | times->sum_exec_runtime = sig->sum_sched_runtime; |
295 | 295 | ||
296 | rcu_read_lock(); | 296 | rcu_read_lock(); |
297 | /* make sure we can trust tsk->thread_group list */ | 297 | for_each_thread(tsk, t) { |
298 | if (!likely(pid_alive(tsk))) | ||
299 | goto out; | ||
300 | |||
301 | t = tsk; | ||
302 | do { | ||
303 | task_cputime(t, &utime, &stime); | 298 | task_cputime(t, &utime, &stime); |
304 | times->utime += utime; | 299 | times->utime += utime; |
305 | times->stime += stime; | 300 | times->stime += stime; |
306 | times->sum_exec_runtime += task_sched_runtime(t); | 301 | times->sum_exec_runtime += task_sched_runtime(t); |
307 | } while_each_thread(tsk, t); | 302 | } |
308 | out: | ||
309 | rcu_read_unlock(); | 303 | rcu_read_unlock(); |
310 | } | 304 | } |
311 | 305 | ||