Messages in this thread | | | Date | Fri, 12 Jun 2009 09:56:50 +0200 | From | Stanislaw Gruszka <> | Subject | Re: [PATCH 1/2] posix-cpu-timers: avoid do_sys_times() races with __exit_signal() |
| |
On Fri, 12 Jun 2009 09:09:58 +0200 Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> On Fri, 2009-06-12 at 08:49 +0200, Stanislaw Gruszka wrote: > > Protect thread_group_cputime() call by siglock, to avoid possible (but > > to be honest - very improbable) double times accounting of exiting task. > > This is revert of commit 2b5fe6de58276d0b5a7c884d5dbfc300ca47db78 > > "thread_group_cputime: move a couple of callsites outside of ->siglock", > > but implementation of thread_group_cputime() was different then. > > Would be nice to have a description of exactly how you'd end up > accounting twice (and thus how this patch fixes it).
In thread_group_cputime() we loop on all threads within the group to sum they cputimes. After finish loop, we add killed tasks times from tsk->signal. If thread (one or more) exit in gap between loop and adding killed tasks times, __exit_signal() function add already accounted times to tsk->signal. So some exiting threads times could be accounted twice.
Stanislaw
| |