diff options
Diffstat (limited to 'litmus/fp_common.c')
-rw-r--r-- | litmus/fp_common.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/litmus/fp_common.c b/litmus/fp_common.c index 7898955fd991..8536da9ca98a 100644 --- a/litmus/fp_common.c +++ b/litmus/fp_common.c | |||
@@ -66,13 +66,9 @@ int fp_higher_prio(struct task_struct* first, | |||
66 | 66 | ||
67 | return !is_realtime(second_task) || | 67 | return !is_realtime(second_task) || |
68 | 68 | ||
69 | /* is the deadline of the first task earlier? | ||
70 | * Then it has higher priority. | ||
71 | */ | ||
72 | get_priority(first_task) < get_priority(second_task) || | 69 | get_priority(first_task) < get_priority(second_task) || |
73 | 70 | ||
74 | /* Do we have a deadline tie? | 71 | /* Break by PID. |
75 | * Then break by PID. | ||
76 | */ | 72 | */ |
77 | (get_priority(first_task) == get_priority(second_task) && | 73 | (get_priority(first_task) == get_priority(second_task) && |
78 | (first_task->pid < second_task->pid || | 74 | (first_task->pid < second_task->pid || |
@@ -97,18 +93,19 @@ void fp_domain_init(rt_domain_t* rt, check_resched_needed_t resched, | |||
97 | 93 | ||
98 | /* need_to_preempt - check whether the task t needs to be preempted | 94 | /* need_to_preempt - check whether the task t needs to be preempted |
99 | */ | 95 | */ |
100 | int fp_preemption_needed(rt_domain_t* rt, struct task_struct *t) | 96 | int fp_preemption_needed(struct fp_prio_queue *q, struct task_struct *t) |
101 | { | 97 | { |
102 | /* we need the read lock for edf_ready_queue */ | 98 | struct task_struct *pending; |
103 | /* no need to preempt if there is nothing pending */ | 99 | |
104 | if (!__jobs_pending(rt)) | 100 | pending = fp_prio_peek(q); |
101 | |||
102 | if (!pending) | ||
105 | return 0; | 103 | return 0; |
106 | /* we need to reschedule if t doesn't exist */ | ||
107 | if (!t) | 104 | if (!t) |
108 | return 1; | 105 | return 1; |
109 | 106 | ||
110 | /* make sure to get non-rt stuff out of the way */ | 107 | /* make sure to get non-rt stuff out of the way */ |
111 | return !is_realtime(t) || fp_higher_prio(__next_ready(rt), t); | 108 | return !is_realtime(t) || fp_higher_prio(pending, t); |
112 | } | 109 | } |
113 | 110 | ||
114 | void fp_prio_queue_init(struct fp_prio_queue* q) | 111 | void fp_prio_queue_init(struct fp_prio_queue* q) |