]> Git Repo - linux.git/commit
sched: Remove rq->lock from the first half of ttwu()
authorPeter Zijlstra <[email protected]>
Tue, 5 Apr 2011 15:23:54 +0000 (17:23 +0200)
committerIngo Molnar <[email protected]>
Thu, 14 Apr 2011 06:52:39 +0000 (08:52 +0200)
commite4a52bcb9a18142d79e231b6733cabdbf2e67c1f
treefcf29647bb6416d826237b90f233b34a169953ab
parent8f42ced974df7d5af2de4cf5ea21fe978c7e4478
sched: Remove rq->lock from the first half of ttwu()

Currently ttwu() does two rq->lock acquisitions, once on the task's
old rq, holding it over the p->state fiddling and load-balance pass.
Then it drops the old rq->lock to acquire the new rq->lock.

By having serialized ttwu(), p->sched_class, p->cpus_allowed with
p->pi_lock, we can now drop the whole first rq->lock acquisition.

The p->pi_lock serializing concurrent ttwu() calls protects p->state,
which we will set to TASK_WAKING to bridge possible p->pi_lock to
rq->lock gaps and serialize set_task_cpu() calls against
task_rq_lock().

The p->pi_lock serialization of p->sched_class allows us to call
scheduling class methods without holding the rq->lock, and the
serialization of p->cpus_allowed allows us to do the load-balancing
bits without races.

Reviewed-by: Frank Rowand <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
kernel/sched.c
This page took 0.054738 seconds and 4 git commands to generate.