diff options
| author | Oleg Nesterov <[email protected]> | 2010-06-11 20:04:46 +0200 |
|---|---|---|
| committer | Ingo Molnar <[email protected]> | 2010-06-18 10:46:57 +0200 |
| commit | 8d1f431cbec115a780cd551ab1b4955c125f8d31 (patch) | |
| tree | f71e707f0ff495582bd2f43017c87b2ac6ec519d /tools/perf/scripts/python | |
| parent | 0bdd2ed4138ec04e09b4f8165981efc99e439f55 (diff) | |
sched: Fix the racy usage of thread_group_cputimer() in fastpath_timer_check()
fastpath_timer_check()->thread_group_cputimer() is racy and
unneeded.
It is racy because another thread can clear ->running before
thread_group_cputimer() takes cputimer->lock. In this case
thread_group_cputimer() will set ->running = true again and call
thread_group_cputime(). But since we do not hold tasklist or
siglock, we can race with fork/exit and copy the wrong results
into cputimer->cputime.
It is unneeded because if ->running == true we can just use
the numbers in cputimer->cputime we already have.
Change fastpath_timer_check() to copy cputimer->cputime into
the local variable under cputimer->lock. We do not re-check
->running under cputimer->lock, run_posix_cpu_timers() does
this check later.
Note: we can add more optimizations on top of this change.
Signed-off-by: Oleg Nesterov <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions