From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>, Carsten Emde <cbe@osadl.org>,
Mathias Weber <mathias.weber.mw1@roche.com>
Subject: [patch 3/3] sched: Queue a deboosted task to the head of the RT priority queue
Date: Wed, 20 Jan 2010 20:59:06 -0000 [thread overview]
Message-ID: <20100120171629.809074113@linutronix.de> (raw)
In-Reply-To: 20100120171231.922420383@linutronix.de
[-- Attachment #1: rtmutex-set-prio-fix-deboost-enqueueing.patch --]
[-- Type: text/plain, Size: 1436 bytes --]
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>
---
kernel/sched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6-tip/kernel/sched.c
===================================================================
--- linux-2.6-tip.orig/kernel/sched.c
+++ linux-2.6-tip/kernel/sched.c
@@ -6066,7 +6066,7 @@ void rt_mutex_setprio(struct task_struct
if (running)
p->sched_class->set_curr_task(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);
}
next prev parent reply other threads:[~2010-01-20 21:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-20 20:58 [patch 0/3] sched: Make Priority Inheritance POSIX compliant Thomas Gleixner
2010-01-20 20:58 ` [patch 1/3] sched: Extend enqueue_task to allow head queueing Thomas Gleixner
2010-01-22 17:12 ` [tip:sched/core] " tip-bot for Thomas Gleixner
2010-01-20 20:59 ` [patch 2/3] sched: Implement head queueing for sched_rt Thomas Gleixner
2010-01-22 17:12 ` [tip:sched/core] " tip-bot for Thomas Gleixner
2010-01-20 20:59 ` Thomas Gleixner [this message]
2010-01-22 17:13 ` [tip:sched/core] sched: Queue a deboosted task to the head of the RT prio queue tip-bot for Thomas Gleixner
2010-01-20 21:06 ` [patch 0/3] sched: Make Priority Inheritance POSIX compliant Peter Zijlstra
2010-01-20 21:59 ` John Kacur
2010-01-21 0:52 ` Carsten Emde
2010-01-21 16:16 ` Weber, Mathias
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100120171629.809074113@linutronix.de \
--to=tglx@linutronix.de \
--cc=cbe@osadl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathias.weber.mw1@roche.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox