diff options
author | 2010-06-11 01:09:56 +0200 | |
---|---|---|
committer | 2010-06-18 10:46:56 +0200 | |
commit | bfac7009180901f57f20a73c53c3e57b1ce75a1b (patch) | |
tree | f167c0a6bfbf397ad668517bdccbc9d0de162715 /tools/perf/util/scripting-engines/trace-event-python.c | |
parent | sched: Remove the obsolete exit_state/signal hacks (diff) | |
download | wireguard-linux-bfac7009180901f57f20a73c53c3e57b1ce75a1b.tar.xz wireguard-linux-bfac7009180901f57f20a73c53c3e57b1ce75a1b.zip |
sched: thread_group_cputime: Simplify, document the "alive" check
thread_group_cputime() looks as if it is rcu-safe, but in fact this
was wrong until ea6d290c which pins task->signal to task_struct.
It checks ->sighand != NULL under rcu, but this can't help if ->signal
can go away. Fortunately the caller either holds ->siglock, or it is
fastpath_timer_check() which uses current and checks exit_state == 0.
- Since ea6d290c commit tsk->signal is stable, we can read it first
and avoid the initialization from INIT_CPUTIME.
- Even if tsk->signal is always valid, we still have to check it
is safe to use next_thread() under rcu_read_lock(). Currently
the code checks ->sighand != NULL, change it to use pid_alive()
which is commonly used to ensure the task wasn't unhashed before
we take rcu_read_lock().
Add the comment to explain this check.
- Change the main loop to use the while_each_thread() helper.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20100610230956.GA25921@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
0 files changed, 0 insertions, 0 deletions