Commit 60db48ca authored by Thomas Gleixner's avatar Thomas Gleixner

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: default avatarMathias Weber <mathias.weber.mw1@roche.com>
Reported-by: default avatarCarsten Emde <cbe@osadl.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
Tested-by: default avatarCarsten Emde <cbe@osadl.org>
Tested-by: default avatarMathias Weber <mathias.weber.mw1@roche.com>
LKML-Reference: <20100120171629.809074113@linutronix.de>
parent 37dad3fc
...@@ -4237,7 +4237,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio) ...@@ -4237,7 +4237,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
if (running) if (running)
p->sched_class->set_curr_task(rq); p->sched_class->set_curr_task(rq);
if (on_rq) { if (on_rq) {
enqueue_task(rq, p, 0, false); enqueue_task(rq, p, 0, oldprio < prio);
check_class_changed(rq, p, prev_class, oldprio, running); check_class_changed(rq, p, prev_class, oldprio, running);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment