diff options
-rw-r--r-- | litmus/Kconfig | 13 | ||||
-rw-r--r-- | litmus/edf_common.c | 32 |
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 | ||
55 | config 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 | |||
55 | endmenu | 68 | endmenu |
56 | 69 | ||
57 | menu "Real-Time Synchronization" | 70 | menu "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 | ||
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) |