diff options
Diffstat (limited to 'litmus/edf_common.c')
-rw-r--r-- | litmus/edf_common.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/litmus/edf_common.c b/litmus/edf_common.c index 9b44dc2d8d1e..6ed927fcce6d 100644 --- a/litmus/edf_common.c +++ b/litmus/edf_common.c | |||
@@ -14,6 +14,17 @@ | |||
14 | 14 | ||
15 | #include <litmus/edf_common.h> | 15 | #include <litmus/edf_common.h> |
16 | 16 | ||
17 | #ifdef DONT_PREEMPT_ON_TIE | ||
18 | static inline cur_sched_higher_prio( | ||
19 | struct task_struct* first, | ||
20 | struct task_struct* second) | ||
21 | { | ||
22 | int first_is_sched = (tsk_rt(first)->scheduled_on != NO_CPU); | ||
23 | int second_is_sched = (tsk_rt(second)->scheduled_on != NO_CPU); | ||
24 | return(first_is_sched > second_is_sched); | ||
25 | } | ||
26 | #endif | ||
27 | |||
17 | /* edf_higher_prio - returns true if first has a higher EDF priority | 28 | /* edf_higher_prio - returns true if first has a higher EDF priority |
18 | * than second. Deadline ties are broken by PID. | 29 | * than second. Deadline ties are broken by PID. |
19 | * | 30 | * |
@@ -71,17 +82,20 @@ int edf_higher_prio(struct task_struct* first, | |||
71 | */ | 82 | */ |
72 | earlier_deadline(first_task, second_task) || | 83 | earlier_deadline(first_task, second_task) || |
73 | 84 | ||
74 | /* Do we have a deadline tie? | 85 | /* tie-break order: cur scheduled, pid, inheritance */ |
75 | * Then break by PID. | ||
76 | */ | ||
77 | (get_deadline(first_task) == get_deadline(second_task) && | 86 | (get_deadline(first_task) == get_deadline(second_task) && |
87 | #ifdef DONT_PREEMPT_ON_TIE | ||
88 | (cur_sched_higher_prio(first, second) || | ||
89 | #endif | ||
78 | (first_task->pid < second_task->pid || | 90 | (first_task->pid < second_task->pid || |
79 | 91 | (first_task->pid == second_task->pid && | |
80 | /* If the PIDs are the same then the task with the inherited | 92 | !second->rt_param.inh_task |
81 | * priority wins. | 93 | ) |
82 | */ | 94 | ) |
83 | (first_task->pid == second_task->pid && | 95 | #ifdef DONT_PREEMPT_ON_TIE |
84 | !second->rt_param.inh_task))); | 96 | ) |
97 | #endif | ||
98 | ); | ||
85 | } | 99 | } |
86 | 100 | ||
87 | int edf_ready_order(struct bheap_node* a, struct bheap_node* b) | 101 | int edf_ready_order(struct bheap_node* a, struct bheap_node* b) |