aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <[email protected]>2014-08-13 21:20:00 +0200
committerIngo Molnar <[email protected]>2014-08-20 09:47:18 +0200
commit1e4dda08b4c39b3d8f4a3ee7269d49e0200c8af8 (patch)
treeecd6e21e803f43c3858aa4c5e12e8f5e05784847 /kernel
parentd38e83c715270cc2e137bbf6f25206c8c023896b (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 <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Hidetoshi Seto <[email protected]> Cc: Frank Mayhar <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Sanjay Rao <[email protected]> Cc: Larry Woodman <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Linus Torvalds <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/cputime.c10
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)
times->sum_exec_runtime = sig->sum_sched_runtime;
rcu_read_lock();
- /* make sure we can trust tsk->thread_group list */
- if (!likely(pid_alive(tsk)))
- goto out;
-
- t = tsk;
- do {
+ for_each_thread(tsk, t) {
task_cputime(t, &utime, &stime);
times->utime += utime;
times->stime += stime;
times->sum_exec_runtime += task_sched_runtime(t);
- } while_each_thread(tsk, t);
-out:
+ }
rcu_read_unlock();
}