aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--litmus/Kconfig13
-rw-r--r--litmus/edf_common.c32
2 files changed, 36 insertions, 9 deletions
diff --git a/litmus/Kconfig b/litmus/Kconfig
index 651b66a77c65..e7376a165be3 100644
--- a/litmus/Kconfig
+++ b/litmus/Kconfig
@@ -52,6 +52,19 @@ config CPU_SCHED_BIAS
52 Only bias towards previously used CPU is currently implemented. In the 52 Only bias towards previously used CPU is currently implemented. In the
53 future: bias on CPU topology. 53 future: bias on CPU topology.
54 54
55config DONT_PREEMPT_ON_TIE
56 bool "Don't preempt a task on priority tie."
57 default n
58 help
59 Don't preempt a scheduled task to schedule another if the two tasks
60 have equal priority. Preformance is improved through the reduction
61 of preemptions. Only tasks with periods that share a common factor
62 will likely see any gains.
63
64 WARNING: Schedulability analysis that depends upon specific
65 tie-breaking rules, such as tie-break on task-id/PID (the default
66 LITMUS behavior), may break.
67
55endmenu 68endmenu
56 69
57menu "Real-Time Synchronization" 70menu "Real-Time Synchronization"
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)