aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-01-20 15:59:06 -0500
committerThomas Gleixner <tglx@linutronix.de>2010-01-22 12:09:59 -0500
commit60db48cacb9b253d5607a5ff206112a59cd09e34 (patch)
tree7fc9be93263ae40381cdafe3cb31c4521e88f2dd /kernel/sched.c
parent37dad3fce97f01e5149d69de0833d8452c0e862e (diff)
sched: Queue a deboosted task to the head of the RT prio queue
rtmutex_set_prio() is used to implement priority inheritance for futexes. When a task is deboosted it gets enqueued at the tail of its RT priority list. This is violating the POSIX scheduling semantics: rt priority list X contains two runnable tasks A and B task A runs with priority X and holds mutex M task C preempts A and is blocked on mutex M -> task A is boosted to priority of task C (Y) task A unlocks the mutex M and deboosts itself -> A is dequeued from rt priority list Y -> A is enqueued to the tail of rt priority list X task C schedules away task B runs This is wrong as task A did not schedule away and therefor violates the POSIX scheduling semantics. Enqueue the task to the head of the priority list instead. Reported-by: Mathias Weber <mathias.weber.mw1@roche.com> Reported-by: Carsten Emde <cbe@osadl.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra <peterz@infradead.org> Tested-by: Carsten Emde <cbe@osadl.org> Tested-by: Mathias Weber <mathias.weber.mw1@roche.com> LKML-Reference: <20100120171629.809074113@linutronix.de>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index f47560ff3346..a56ead42d651 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4237,7 +4237,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
4237 if (running) 4237 if (running)
4238 p->sched_class->set_curr_task(rq); 4238 p->sched_class->set_curr_task(rq);
4239 if (on_rq) { 4239 if (on_rq) {
4240 enqueue_task(rq, p, 0, false); 4240 enqueue_task(rq, p, 0, oldprio < prio);
4241 4241
4242 check_class_changed(rq, p, prev_class, oldprio, running); 4242 check_class_changed(rq, p, prev_class, oldprio, running);
4243 } 4243 }