Skip to content

Commit 1e4dda0

Browse files
oleg-nesterovingomolnar
authored andcommitted
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>
1 parent d38e83c commit 1e4dda0

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

‎kernel/sched/cputime.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,18 +294,12 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
294294
times->sum_exec_runtime = sig->sum_sched_runtime;
295295

296296
rcu_read_lock();
297-
/* make sure we can trust tsk->thread_group list */
298-
if (!likely(pid_alive(tsk)))
299-
goto out;
300-
301-
t = tsk;
302-
do {
297+
for_each_thread(tsk, t) {
303298
task_cputime(t, &utime, &stime);
304299
times->utime += utime;
305300
times->stime += stime;
306301
times->sum_exec_runtime += task_sched_runtime(t);
307-
} while_each_thread(tsk, t);
308-
out:
302+
}
309303
rcu_read_unlock();
310304
}
311305

0 commit comments

Comments
 (0)