aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/edf_common.c
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2011-01-28 19:04:08 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2011-02-01 16:30:41 -0500
commite593c9dbe858c82e284ff85e625837ae3ab32f1c (patch)
treeef1b5a608545ddf276517b85f57999c925242627 /litmus/edf_common.c
parentfc6482bb7a6a638474565c90159997bd59069297 (diff)
EDF: support priority boosting
While we are at it, simplify edf_higher_prio() a bit.
Diffstat (limited to 'litmus/edf_common.c')
-rw-r--r--litmus/edf_common.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/litmus/edf_common.c b/litmus/edf_common.c
index 06daec66c984..9b44dc2d8d1e 100644
--- a/litmus/edf_common.c
+++ b/litmus/edf_common.c
@@ -33,22 +33,38 @@ int edf_higher_prio(struct task_struct* first,
33 } 33 }
34 34
35 35
36 /* check for NULL tasks */
37 if (!first || !second)
38 return first && !second;
39
40#ifdef CONFIG_LITMUS_LOCKING
41
36 /* Check for inherited priorities. Change task 42 /* Check for inherited priorities. Change task
37 * used for comparison in such a case. 43 * used for comparison in such a case.
38 */ 44 */
39 if (first && first->rt_param.inh_task) 45 if (unlikely(first->rt_param.inh_task))
40 first_task = first->rt_param.inh_task; 46 first_task = first->rt_param.inh_task;
41 if (second && second->rt_param.inh_task) 47 if (unlikely(second->rt_param.inh_task))
42 second_task = second->rt_param.inh_task; 48 second_task = second->rt_param.inh_task;
43 49
44 return 50 /* Check for priority boosting. Tie-break by start of boosting.
45 /* it has to exist in order to have higher priority */ 51 */
46 first_task && ( 52 if (unlikely(is_priority_boosted(first_task))) {
47 /* does the second task exist and is it a real-time task? If 53 /* first_task is boosted, how about second_task? */
48 * not, the first task (which is a RT task) has higher 54 if (!is_priority_boosted(second_task) ||
49 * priority. 55 lt_before(get_boost_start(first_task),
50 */ 56 get_boost_start(second_task)))
51 !second_task || !is_realtime(second_task) || 57 return 1;
58 else
59 return 0;
60 } else if (unlikely(is_priority_boosted(second_task)))
61 /* second_task is boosted, first is not*/
62 return 0;
63
64#endif
65
66
67 return !is_realtime(second_task) ||
52 68
53 /* is the deadline of the first task earlier? 69 /* is the deadline of the first task earlier?
54 * Then it has higher priority. 70 * Then it has higher priority.
@@ -65,7 +81,7 @@ int edf_higher_prio(struct task_struct* first,
65 * priority wins. 81 * priority wins.
66 */ 82 */
67 (first_task->pid == second_task->pid && 83 (first_task->pid == second_task->pid &&
68 !second->rt_param.inh_task)))); 84 !second->rt_param.inh_task)));
69} 85}
70 86
71int edf_ready_order(struct bheap_node* a, struct bheap_node* b) 87int edf_ready_order(struct bheap_node* a, struct bheap_node* b)