aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2013-11-07 08:43:43 -0500
committerIngo Molnar <mingo@kernel.org>2014-01-13 07:41:50 -0500
commitfb00aca474405f4fa8a8519c3179fed722eabd83 (patch)
tree8a779629a771dd3340d5a3ba0ba16b732b8de1c8 /include/linux/sched.h
parentaf6ace764d03900524e9b1ac621a1c520ee49fc6 (diff)
rtmutex: Turn the plist into an rb-tree
Turn the pi-chains from plist to rb-tree, in the rt_mutex code, and provide a proper comparison function for -deadline and -priority tasks. This is done mainly because: - classical prio field of the plist is just an int, which might not be enough for representing a deadline; - manipulating such a list would become O(nr_deadline_tasks), which might be to much, as the number of -deadline task increases. Therefore, an rb-tree is used, and tasks are queued in it according to the following logic: - among two -priority (i.e., SCHED_BATCH/OTHER/RR/FIFO) tasks, the one with the higher (lower, actually!) prio wins; - among a -priority and a -deadline task, the latter always wins; - among two -deadline tasks, the one with the earliest deadline wins. Queueing and dequeueing functions are changed accordingly, for both the list of a task's pi-waiters and the list of tasks blocked on a pi-lock. Signed-off-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Dario Faggioli <raistlin@linux.it> Signed-off-by: Juri Lelli <juri.lelli@gmail.com> Signed-off-again-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1383831828-15501-10-git-send-email-juri.lelli@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 158f4c2dd852..9ea15019a5b6 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -16,6 +16,7 @@ struct sched_param {
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/timex.h> 17#include <linux/timex.h>
18#include <linux/jiffies.h> 18#include <linux/jiffies.h>
19#include <linux/plist.h>
19#include <linux/rbtree.h> 20#include <linux/rbtree.h>
20#include <linux/thread_info.h> 21#include <linux/thread_info.h>
21#include <linux/cpumask.h> 22#include <linux/cpumask.h>
@@ -1354,7 +1355,8 @@ struct task_struct {
1354 1355
1355#ifdef CONFIG_RT_MUTEXES 1356#ifdef CONFIG_RT_MUTEXES
1356 /* PI waiters blocked on a rt_mutex held by this task */ 1357 /* PI waiters blocked on a rt_mutex held by this task */
1357 struct plist_head pi_waiters; 1358 struct rb_root pi_waiters;
1359 struct rb_node *pi_waiters_leftmost;
1358 /* Deadlock detection and priority inheritance handling */ 1360 /* Deadlock detection and priority inheritance handling */
1359 struct rt_mutex_waiter *pi_blocked_on; 1361 struct rt_mutex_waiter *pi_blocked_on;
1360#endif 1362#endif