diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-09-16 18:29:36 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-09-16 18:29:36 -0400 |
commit | c58a74c8ad2d2b1b01be12afb9bac58dfef0d16a (patch) | |
tree | 60dbed545715ecf91ab7409789c1a9effd791348 /litmus/edf_common.c | |
parent | 4e8f9b7c2e9134ca31feb91dee3609a95df6de56 (diff) |
Added CONFIG_REALTIME_AUX_TASKS option
Auxillary task features were enabled by CONFIG_LITMUS_LOCKING.
Made auxillary tasks a seperate feature that depends upon
CONFIG_LITMUS_LOCKING.
Diffstat (limited to 'litmus/edf_common.c')
-rw-r--r-- | litmus/edf_common.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/litmus/edf_common.c b/litmus/edf_common.c index ca06f6ec103e..7e0d3a5d0c4d 100644 --- a/litmus/edf_common.c +++ b/litmus/edf_common.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <litmus/fpmath.h> | 22 | #include <litmus/fpmath.h> |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | //#ifdef CONFIG_EDF_TIE_BREAK_HASH | 25 | #if defined(CONFIG_EDF_TIE_BREAK_HASH) || defined(CONFIG_REALTIME_AUX_TASKS) |
26 | #include <linux/hash.h> | 26 | #include <linux/hash.h> |
27 | static inline long edf_hash(struct task_struct *t) | 27 | static inline long edf_hash(struct task_struct *t) |
28 | { | 28 | { |
@@ -41,8 +41,9 @@ static inline long edf_hash(struct task_struct *t) | |||
41 | */ | 41 | */ |
42 | return hash_32(hash_32((u32)tsk_rt(t)->job_params.job_no, 32) ^ t->pid, 32); | 42 | return hash_32(hash_32((u32)tsk_rt(t)->job_params.job_no, 32) ^ t->pid, 32); |
43 | } | 43 | } |
44 | //#endif | 44 | #endif |
45 | 45 | ||
46 | #ifdef CONFIG_REALTIME_AUX_TASKS | ||
46 | int aux_tie_break(struct task_struct *first, struct task_struct *second) | 47 | int aux_tie_break(struct task_struct *first, struct task_struct *second) |
47 | { | 48 | { |
48 | long fhash = edf_hash(first); | 49 | long fhash = edf_hash(first); |
@@ -57,6 +58,7 @@ int aux_tie_break(struct task_struct *first, struct task_struct *second) | |||
57 | } | 58 | } |
58 | return 0; | 59 | return 0; |
59 | } | 60 | } |
61 | #endif | ||
60 | 62 | ||
61 | 63 | ||
62 | /* edf_higher_prio - returns true if first has a higher EDF priority | 64 | /* edf_higher_prio - returns true if first has a higher EDF priority |
@@ -75,11 +77,6 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
75 | struct task_struct *first_task = first; | 77 | struct task_struct *first_task = first; |
76 | struct task_struct *second_task = second; | 78 | struct task_struct *second_task = second; |
77 | 79 | ||
78 | int first_lo_aux; | ||
79 | int second_lo_aux; | ||
80 | int first_hi_aux; | ||
81 | int second_hi_aux; | ||
82 | |||
83 | /* There is no point in comparing a task to itself. */ | 80 | /* There is no point in comparing a task to itself. */ |
84 | if (first && first == second) { | 81 | if (first && first == second) { |
85 | TRACE_CUR("WARNING: pointless edf priority comparison: %s/%d\n", first->comm, first->pid); | 82 | TRACE_CUR("WARNING: pointless edf priority comparison: %s/%d\n", first->comm, first->pid); |
@@ -93,8 +90,14 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
93 | return first && !second; | 90 | return first && !second; |
94 | } | 91 | } |
95 | 92 | ||
96 | #ifdef CONFIG_LITMUS_LOCKING | 93 | #ifdef CONFIG_REALTIME_AUX_TASKS |
94 | { | ||
95 | /* statically prioritize all auxillary tasks that have no inheritance | ||
96 | * below all other regular real-time tasks. | ||
97 | */ | ||
97 | 98 | ||
99 | int first_lo_aux, second_lo_aux; | ||
100 | int first_hi_aux, second_hi_aux; | ||
98 | first_lo_aux = first->rt_param.is_aux_task && !first->rt_param.inh_task; | 101 | first_lo_aux = first->rt_param.is_aux_task && !first->rt_param.inh_task; |
99 | second_lo_aux = second->rt_param.is_aux_task && !second->rt_param.inh_task; | 102 | second_lo_aux = second->rt_param.is_aux_task && !second->rt_param.inh_task; |
100 | 103 | ||
@@ -120,8 +123,10 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
120 | TRACE_CUR("hi aux tie break: %s/%d >> %s/%d --- %d\n", first->comm, first->pid, second->comm, second->pid, aux_hi_tie_break); | 123 | TRACE_CUR("hi aux tie break: %s/%d >> %s/%d --- %d\n", first->comm, first->pid, second->comm, second->pid, aux_hi_tie_break); |
121 | return aux_hi_tie_break; | 124 | return aux_hi_tie_break; |
122 | } | 125 | } |
126 | } | ||
127 | #endif | ||
123 | 128 | ||
124 | 129 | #ifdef CONFIG_LITMUS_LOCKING | |
125 | /* Check for EFFECTIVE priorities. Change task | 130 | /* Check for EFFECTIVE priorities. Change task |
126 | * used for comparison in such a case. | 131 | * used for comparison in such a case. |
127 | */ | 132 | */ |
@@ -233,11 +238,13 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
233 | return 1; | 238 | return 1; |
234 | } | 239 | } |
235 | #endif | 240 | #endif |
241 | |||
242 | #ifdef CONFIG_REALTIME_AUX_TASKS | ||
243 | /* is this dead code? */ | ||
236 | if (tsk_rt(first)->is_aux_task < tsk_rt(second)->is_aux_task) { | 244 | if (tsk_rt(first)->is_aux_task < tsk_rt(second)->is_aux_task) { |
237 | TRACE_CUR("AUX BREAK!\n"); | ||
238 | return 1; | 245 | return 1; |
239 | } | 246 | } |
240 | 247 | #endif | |
241 | 248 | ||
242 | /* Something could be wrong if you get this far. */ | 249 | /* Something could be wrong if you get this far. */ |
243 | if (unlikely(first->rt_param.inh_task == | 250 | if (unlikely(first->rt_param.inh_task == |