summaryrefslogtreecommitdiff
path: root/kernel/rtmutex.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-12-20 14:13:49 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-10 00:18:34 (GMT)
commit7287941301f62f31b2731d306c9f2d1d3745f8e8 (patch)
treecf899785ce9647ae27d2601010e290764ef6a32c /kernel/rtmutex.c
parentefb2fb86cd10f4248e1570fa70bb0c4d40b4bc09 (diff)
downloadlinux-fsl-qoriq-7287941301f62f31b2731d306c9f2d1d3745f8e8.tar.xz
sched: Consider pi boosting in setscheduler
If a PI boosted task policy/priority is modified by a setscheduler() call we unconditionally dequeue and requeue the task if it is on the runqueue even if the new priority is lower than the current effective boosted priority. This can result in undesired reordering of the priority bucket list. If the new priority is less or equal than the current effective we just store the new parameters in the task struct and leave the scheduler class and the runqueue untouched. This is handled when the task deboosts itself. Only if the new priority is higher than the effective boosted priority we apply the change immediately. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org Cc: stable-rt@vger.kernel.org
Diffstat (limited to 'kernel/rtmutex.c')
-rw-r--r--kernel/rtmutex.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 0dd6aec..2656896 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -107,6 +107,18 @@ int rt_mutex_getprio(struct task_struct *task)
}
/*
+ * Called by sched_setscheduler() to check whether the priority change
+ * is overruled by a possible priority boosting.
+ */
+int rt_mutex_check_prio(struct task_struct *task, int newprio)
+{
+ if (!task_has_pi_waiters(task))
+ return 0;
+
+ return task_top_pi_waiter(task)->pi_list_entry.prio <= newprio;
+}
+
+/*
* Adjust the priority of a task, after its pi_waiters got modified.
*
* This can be both boosting and unboosting. task->pi_lock must be held.