cpu-timers: Avoid iterating over all threads in fastpath_timer_check()
authorStanislaw Gruszka <sgruszka@redhat.com>
Thu, 11 Mar 2010 22:04:42 +0000 (14:04 -0800)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 12 Mar 2010 21:40:41 +0000 (22:40 +0100)
commitc28739375bf0d6e239b4fa939ec8372aa2c707d2
tree9d213503878c59b7adc9ca3e0517c566921f3c9a
parent1f169f84d25a74fb2dc67274d31d082ce30c60fb
cpu-timers: Avoid iterating over all threads in fastpath_timer_check()

Spread p->sighand->siglock locking scope to make sure that
fastpath_timer_check() never iterates over all threads. Without
locking there is small possibility that signal->cputimer will stop
running while we write values to signal->cputime_expires.

Calling thread_group_cputime() from fastpath_timer_check() is not only
bad because it is slow, also it is racy with __exit_signal() which can
lead to invalid signal->{s,u}time values.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/posix-cpu-timers.c