diff options
| author | Tanya Amert <tamert@cs.unc.edu> | 2020-10-14 21:07:19 -0400 |
|---|---|---|
| committer | Tanya Amert <tamert@cs.unc.edu> | 2020-10-14 21:07:19 -0400 |
| commit | 69b88f7b7d51582c6def81a32760d1f957a9675f (patch) | |
| tree | 8d4582f9b94e8007e648a153e2318408b76fd729 | |
| parent | 543a6532f42d9d085967dd4855a65a099438dd1c (diff) | |
Added final step of priority inheritance.omlp
| -rw-r--r-- | litmus/reservations/ext_reservation.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/litmus/reservations/ext_reservation.c b/litmus/reservations/ext_reservation.c index ad8bc7238631..0e02b8f2f877 100644 --- a/litmus/reservations/ext_reservation.c +++ b/litmus/reservations/ext_reservation.c | |||
| @@ -21,6 +21,18 @@ int higher_res_prio(struct reservation* first, | |||
| 21 | if (!first || !second) | 21 | if (!first || !second) |
| 22 | return first && !second; | 22 | return first && !second; |
| 23 | 23 | ||
| 24 | #ifdef CONFIG_LITMUS_LOCKING | ||
| 25 | |||
| 26 | /* Check for inherited priorities. Change reservation | ||
| 27 | * used for comparison in such a case. | ||
| 28 | */ | ||
| 29 | if (unlikely(first->inh_res)) | ||
| 30 | first_task = first->inh_res; | ||
| 31 | if (unlikely(second->inh_res)) | ||
| 32 | second_task = second->inh_res; | ||
| 33 | |||
| 34 | #endif | ||
| 35 | |||
| 24 | if (first_task->priority > second_task->priority) { | 36 | if (first_task->priority > second_task->priority) { |
| 25 | return 1; | 37 | return 1; |
| 26 | } | 38 | } |
| @@ -29,6 +41,16 @@ int higher_res_prio(struct reservation* first, | |||
| 29 | if (first_task->id < second_task->id) { | 41 | if (first_task->id < second_task->id) { |
| 30 | return 1; | 42 | return 1; |
| 31 | } | 43 | } |
| 44 | #ifdef CONFIG_LITMUS_LOCKING | ||
| 45 | else if (first_task->id == second_task->id) { | ||
| 46 | /* If the PIDs are the same then the task with the | ||
| 47 | * inherited priority wins. | ||
| 48 | */ | ||
| 49 | if (!second->inh_res) { | ||
| 50 | return 1; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | #endif | ||
| 32 | } | 54 | } |
| 33 | //TODO: TAKE INTO ACCOUNT INH_TASK WHEN DOING PRIO COMPARISONS | 55 | //TODO: TAKE INTO ACCOUNT INH_TASK WHEN DOING PRIO COMPARISONS |
| 34 | return 0; /* fall-through. prio(second_task) > prio(first_task) */ | 56 | return 0; /* fall-through. prio(second_task) > prio(first_task) */ |
