diff options
Diffstat (limited to 'litmus/edf_common.c')
-rw-r--r-- | litmus/edf_common.c | 76 |
1 files changed, 43 insertions, 33 deletions
diff --git a/litmus/edf_common.c b/litmus/edf_common.c index 989757cdcc5c..250808e934a6 100644 --- a/litmus/edf_common.c +++ b/litmus/edf_common.c | |||
@@ -45,8 +45,9 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
45 | 45 | ||
46 | 46 | ||
47 | /* check for NULL tasks */ | 47 | /* check for NULL tasks */ |
48 | if (!first || !second) | 48 | if (!first || !second) { |
49 | return first && !second; | 49 | return first && !second; |
50 | } | ||
50 | 51 | ||
51 | #ifdef CONFIG_LITMUS_LOCKING | 52 | #ifdef CONFIG_LITMUS_LOCKING |
52 | /* Check for EFFECTIVE priorities. Change task | 53 | /* Check for EFFECTIVE priorities. Change task |
@@ -73,59 +74,68 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
73 | /* first_task is boosted, how about second_task? */ | 74 | /* first_task is boosted, how about second_task? */ |
74 | if (!is_priority_boosted(second_task) || | 75 | if (!is_priority_boosted(second_task) || |
75 | lt_before(get_boost_start(first_task), | 76 | lt_before(get_boost_start(first_task), |
76 | get_boost_start(second_task))) | 77 | get_boost_start(second_task))) { |
77 | return 1; | 78 | return 1; |
78 | else | 79 | } |
80 | else { | ||
79 | return 0; | 81 | return 0; |
80 | } else if (unlikely(is_priority_boosted(second_task))) | 82 | } |
83 | } | ||
84 | else if (unlikely(is_priority_boosted(second_task))) { | ||
81 | /* second_task is boosted, first is not*/ | 85 | /* second_task is boosted, first is not*/ |
82 | return 0; | 86 | return 0; |
87 | } | ||
83 | 88 | ||
84 | #endif | 89 | #endif |
85 | 90 | ||
86 | // // rate-monotonic for testing | 91 | // // rate-monotonic for testing |
87 | // return !is_realtime(second_task) || | 92 | // if (!is_realtime(second_task)) { |
88 | // | 93 | // return true; |
89 | // /* is the deadline of the first task earlier? | 94 | // } |
90 | // * Then it has higher priority. | 95 | // |
91 | // */ | 96 | // if (shorter_period(first_task, second_task)) { |
92 | // shorter_period(first_task, second_task) || | 97 | // return true; |
93 | // | 98 | // } |
94 | // /* Do we have a deadline tie? | 99 | // |
95 | // * Then break by PID. | 100 | // if (get_period(first_task) == get_period(second_task)) { |
96 | // */ | 101 | // if (first_task->pid < second_task->pid) { |
97 | // (get_period(first_task) == get_period(second_task) && | 102 | // return true; |
98 | // (first_task->pid < second_task->pid || | 103 | // } |
99 | // | 104 | // else if (first_task->pid == second_task->pid) { |
100 | // /* If the PIDs are the same then the task with the EFFECTIVE | 105 | // return !second->rt_param.inh_task; |
101 | // * priority wins. | 106 | // } |
102 | // */ | 107 | // } |
103 | // (first_task->pid == second_task->pid && | 108 | |
104 | // !second->rt_param.inh_task))); | 109 | if (!is_realtime(second_task)) { |
105 | |||
106 | if (!is_realtime(second_task)) | ||
107 | return true; | 110 | return true; |
111 | } | ||
108 | 112 | ||
109 | if (earlier_deadline(first_task, second_task)) | 113 | if (earlier_deadline(first_task, second_task)) { |
110 | return true; | 114 | return true; |
111 | 115 | } | |
112 | if (get_deadline(first_task) == get_deadline(second_task)) { | 116 | if (get_deadline(first_task) == get_deadline(second_task)) { |
117 | |||
113 | if (shorter_period(first_task, second_task)) { | 118 | if (shorter_period(first_task, second_task)) { |
114 | return true; | 119 | return true; |
115 | } | 120 | } |
116 | if (get_rt_period(first_task) == get_rt_period(second_task)) { | 121 | if (get_rt_period(first_task) == get_rt_period(second_task)) { |
117 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
118 | if (first_task->rt_param.is_proxy_thread < | ||
119 | second_task->rt_param.is_proxy_thread) { | ||
120 | return true; | ||
121 | } | ||
122 | #endif | ||
123 | if (first_task->pid < second_task->pid) { | 122 | if (first_task->pid < second_task->pid) { |
124 | return true; | 123 | return true; |
125 | } | 124 | } |
126 | if (first_task->pid == second_task->pid) { | 125 | if (first_task->pid == second_task->pid) { |
126 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
127 | if (first_task->rt_param.is_proxy_thread < | ||
128 | second_task->rt_param.is_proxy_thread) { | ||
129 | return true; | ||
130 | } | ||
131 | if(first_task->rt_param.is_proxy_thread == second_task->rt_param.is_proxy_thread) { | ||
132 | return !second->rt_param.inh_task; | ||
133 | } | ||
134 | #else | ||
127 | return !second->rt_param.inh_task; | 135 | return !second->rt_param.inh_task; |
128 | } | 136 | #endif |
137 | } | ||
138 | |||
129 | } | 139 | } |
130 | } | 140 | } |
131 | 141 | ||