sched: Add p->pi_lock to task_rq_lock()
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Tue, 5 Apr 2011 15:23:51 +0000 (17:23 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 14 Apr 2011 06:52:38 +0000 (08:52 +0200)
commit0122ec5b02f766c355b3168df53a6c038a24fa0d
tree5fa335e80a0110a14e3b9de98780149283f73bbe
parent2acca55ed98ad9b9aa25e7e587ebe306c0313dc7
sched: Add p->pi_lock to task_rq_lock()

In order to be able to call set_task_cpu() while either holding
p->pi_lock or task_rq(p)->lock we need to hold both locks in order to
stabilize task_rq().

This makes task_rq_lock() acquire both locks, and have
__task_rq_lock() validate that p->pi_lock is held. This increases the
locking overhead for most scheduler syscalls but allows reduction of
rq->lock contention for some scheduler hot paths (ttwu).

Reviewed-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20110405152729.232781355@chello.nl
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched.c