aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/edf_common.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-09-11 15:25:29 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2012-09-11 15:25:29 -0400
commita916d9b2feaeb5934e1f8ba30fde74193a60e8d1 (patch)
treeecbd2faabe3ae38ac92d7ac807ce76f954b17e96 /litmus/edf_common.c
parentf4260f81a68d170b1d3558b5447343224d918a45 (diff)
Fix hang from bug in edf_common.c
Diffstat (limited to 'litmus/edf_common.c')
-rw-r--r--litmus/edf_common.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/litmus/edf_common.c b/litmus/edf_common.c
index a1cdc10ea6f1..39ce1816ee04 100644
--- a/litmus/edf_common.c
+++ b/litmus/edf_common.c
@@ -185,11 +185,37 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second)
185 return 1; 185 return 1;
186 } 186 }
187#endif 187#endif
188 /* If the PIDs are the same then the task with the 188 /* Something could be wrong if you get this far. */
189 * inherited priority wins. 189 if (unlikely(first->rt_param.inh_task ==
190 */ 190 second->rt_param.inh_task)) {
191 if (!second_task->rt_param.inh_task) { 191 /* Both tasks have the same inherited priority.
192 return 1; 192 * Likely in a bug-condition.
193 */
194 if (likely(first->pid < second->pid)) {
195 return 1;
196 }
197 else if (first->pid == second->pid) {
198 WARN_ON(1);
199 }
200 }
201 else {
202 /* At least one task must inherit */
203 BUG_ON(!first->rt_param.inh_task &&
204 !second->rt_param.inh_task);
205
206 /* The task with the inherited priority wins. */
207 if (!second->rt_param.inh_task) {
208 TRACE_CUR("unusual comparison: "
209 "first = %s/%d first_task = %s/%d "
210 "second = %s/%d second_task = %s/%d\n",
211 first->comm, first->pid,
212 (first->rt_param.inh_task) ? first->rt_param.inh_task->comm : "(nil)",
213 (first->rt_param.inh_task) ? first->rt_param.inh_task->pid : 0,
214 second->comm, second->pid,
215 (second->rt_param.inh_task) ? second->rt_param.inh_task->comm : "(nil)",
216 (second->rt_param.inh_task) ? second->rt_param.inh_task->pid : 0);
217 return 1;
218 }
193 } 219 }
194 } 220 }
195 } 221 }