aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/edf_common.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2011-04-09 09:58:34 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2011-04-09 13:41:32 -0400
commit9caacb13297747118cf178870345cdfcb597aa44 (patch)
treea5a3376d8b18e48cafb8211f42ec5599d60949e4 /litmus/edf_common.c
parentd3f99f11f3440d70658b9d9df756bbd9b63f8058 (diff)
CONFIG_DONT_PREEMPT_ON_TIE: Don't preeempt a scheduled task on priority tie.wip-performance
Added the compilation option CONFIG_DONT_PREEMPT_ON_TIE. In the event of a priority tie, a task that is currently scheduled is favored over one that is not. If both tasks are scheduled (or both are not), then tie breaks on PID and inheritance still hold. Configuration option includes a warning that schedulability analysis that depends upon task-id/PID tie-breaks breaks when CONFIG_DONT_PREEMPT_ON_TIE is enabled. Pfair/PD^2 not supported.
Diffstat (limited to 'litmus/edf_common.c')
-rw-r--r--litmus/edf_common.c32
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
18static 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
87int edf_ready_order(struct bheap_node* a, struct bheap_node* b) 101int edf_ready_order(struct bheap_node* a, struct bheap_node* b)