diff options
author | Peter Zijlstra <peterz@infradead.org> | 2013-11-07 08:43:43 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-01-13 07:41:50 -0500 |
commit | fb00aca474405f4fa8a8519c3179fed722eabd83 (patch) | |
tree | 8a779629a771dd3340d5a3ba0ba16b732b8de1c8 /include/linux/init_task.h | |
parent | af6ace764d03900524e9b1ac621a1c520ee49fc6 (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/init_task.h')
-rw-r--r-- | include/linux/init_task.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index b0ed422e4e4a..f0e52383a001 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/user_namespace.h> | 11 | #include <linux/user_namespace.h> |
12 | #include <linux/securebits.h> | 12 | #include <linux/securebits.h> |
13 | #include <linux/seqlock.h> | 13 | #include <linux/seqlock.h> |
14 | #include <linux/rbtree.h> | ||
14 | #include <net/net_namespace.h> | 15 | #include <net/net_namespace.h> |
15 | #include <linux/sched/rt.h> | 16 | #include <linux/sched/rt.h> |
16 | 17 | ||
@@ -154,6 +155,14 @@ extern struct task_group root_task_group; | |||
154 | 155 | ||
155 | #define INIT_TASK_COMM "swapper" | 156 | #define INIT_TASK_COMM "swapper" |
156 | 157 | ||
158 | #ifdef CONFIG_RT_MUTEXES | ||
159 | # define INIT_RT_MUTEXES(tsk) \ | ||
160 | .pi_waiters = RB_ROOT, \ | ||
161 | .pi_waiters_leftmost = NULL, | ||
162 | #else | ||
163 | # define INIT_RT_MUTEXES(tsk) | ||
164 | #endif | ||
165 | |||
157 | /* | 166 | /* |
158 | * INIT_TASK is used to set up the first task table, touch at | 167 | * INIT_TASK is used to set up the first task table, touch at |
159 | * your own risk!. Base=0, limit=0x1fffff (=2MB) | 168 | * your own risk!. Base=0, limit=0x1fffff (=2MB) |
@@ -221,6 +230,7 @@ extern struct task_group root_task_group; | |||
221 | INIT_TRACE_RECURSION \ | 230 | INIT_TRACE_RECURSION \ |
222 | INIT_TASK_RCU_PREEMPT(tsk) \ | 231 | INIT_TASK_RCU_PREEMPT(tsk) \ |
223 | INIT_CPUSET_SEQ(tsk) \ | 232 | INIT_CPUSET_SEQ(tsk) \ |
233 | INIT_RT_MUTEXES(tsk) \ | ||
224 | INIT_VTIME(tsk) \ | 234 | INIT_VTIME(tsk) \ |
225 | } | 235 | } |
226 | 236 | ||