Commit 1e4dda08 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Ingo Molnar

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: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarPeter 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.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent d38e83c7
...@@ -294,18 +294,12 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) ...@@ -294,18 +294,12 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
times->sum_exec_runtime = sig->sum_sched_runtime; times->sum_exec_runtime = sig->sum_sched_runtime;
rcu_read_lock(); rcu_read_lock();
/* make sure we can trust tsk->thread_group list */ for_each_thread(tsk, t) {
if (!likely(pid_alive(tsk)))
goto out;
t = tsk;
do {
task_cputime(t, &utime, &stime); task_cputime(t, &utime, &stime);
times->utime += utime; times->utime += utime;
times->stime += stime; times->stime += stime;
times->sum_exec_runtime += task_sched_runtime(t); times->sum_exec_runtime += task_sched_runtime(t);
} while_each_thread(tsk, t); }
out:
rcu_read_unlock(); rcu_read_unlock();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment