diff options
Diffstat (limited to 'litmus/edf_common.c')
-rw-r--r-- | litmus/edf_common.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/litmus/edf_common.c b/litmus/edf_common.c index 668737f0fbf9..54285aaa0405 100644 --- a/litmus/edf_common.c +++ b/litmus/edf_common.c | |||
@@ -78,17 +78,27 @@ int edf_higher_prio(struct task_struct* first, | |||
78 | else if (get_deadline(first_task) == get_deadline(second_task)) { | 78 | else if (get_deadline(first_task) == get_deadline(second_task)) { |
79 | /* Need to tie break */ | 79 | /* Need to tie break */ |
80 | 80 | ||
81 | /* Tie break by pid */ | 81 | /* Tie break by lateness. Jobs with greater lateness get |
82 | if (first_task->pid < second_task->pid) { | 82 | * priority. This should spread tardiness across all tasks, |
83 | * especially in task sets where all tasks have the same | ||
84 | * period and relative deadlines. | ||
85 | */ | ||
86 | if (get_lateness(first_task) > get_lateness(second_task)) { | ||
83 | return 1; | 87 | return 1; |
84 | } | 88 | } |
85 | else if (first_task->pid == second_task->pid) { | 89 | else if(get_lateness(first_task) == get_lateness(second_task)) { |
86 | /* If the PIDs are the same then the task with the | 90 | /* Tie break by pid */ |
87 | * inherited priority wins. | 91 | if (first_task->pid < second_task->pid) { |
88 | */ | ||
89 | if (!second_task->rt_param.inh_task) { | ||
90 | return 1; | 92 | return 1; |
91 | } | 93 | } |
94 | else if (first_task->pid == second_task->pid) { | ||
95 | /* If the PIDs are the same then the task with the | ||
96 | * inherited priority wins. | ||
97 | */ | ||
98 | if (!second_task->rt_param.inh_task) { | ||
99 | return 1; | ||
100 | } | ||
101 | } | ||
92 | } | 102 | } |
93 | } | 103 | } |
94 | return 0; /* fall-through. prio(second_task) > prio(first_task) */ | 104 | return 0; /* fall-through. prio(second_task) > prio(first_task) */ |