Re: [PATCH 1/2] posix-cpu-timers: avoid do_sys_times() races with__exit_signal()

From: Stanislaw Gruszka
Date: Fri Jun 12 2009 - 04:04:26 EST


On Fri, 12 Jun 2009 09:09:58 +0200
Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/