aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_psn_edf.c
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2010-11-10 12:10:49 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-11-11 17:57:44 -0500
commitfb3df2ec261d8cd6bcb8206d9d985355214d7767 (patch)
treec41f8818ad4f1b699afbe292d131c1073b4d7c6e /litmus/sched_psn_edf.c
parent516b6601bb5f71035e8859735a25dea0da4a0211 (diff)
Implement proper remote preemption support
To date, Litmus has just hooked into the smp_send_reschedule() IPI handler and marked tasks as having to reschedule to implement remote preemptions. This was never particularly clean, but so far we got away with it. However, changes in the underlying Linux, and peculartities of the ARM code (interrupts enabled before context switch) break this naive approach. This patch introduces new state-machine based remote preemption support. By examining the local state before calling set_tsk_need_resched(), we avoid confusing the underlying Linux scheduler. Further, this patch avoids sending unncessary IPIs.
Diffstat (limited to 'litmus/sched_psn_edf.c')
-rw-r--r--litmus/sched_psn_edf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c
index aa567f2b91b9..b89823d5c026 100644
--- a/litmus/sched_psn_edf.c
+++ b/litmus/sched_psn_edf.c
@@ -16,6 +16,7 @@
16 16
17#include <litmus/litmus.h> 17#include <litmus/litmus.h>
18#include <litmus/jobs.h> 18#include <litmus/jobs.h>
19#include <litmus/preempt.h>
19#include <litmus/sched_plugin.h> 20#include <litmus/sched_plugin.h>
20#include <litmus/edf_common.h> 21#include <litmus/edf_common.h>
21#include <litmus/sched_trace.h> 22#include <litmus/sched_trace.h>
@@ -108,7 +109,7 @@ static void psnedf_tick(struct task_struct *t)
108 109
109 if (is_realtime(t) && budget_enforced(t) && budget_exhausted(t)) { 110 if (is_realtime(t) && budget_enforced(t) && budget_exhausted(t)) {
110 if (!is_np(t)) { 111 if (!is_np(t)) {
111 set_tsk_need_resched(t); 112 litmus_reschedule_local();
112 TRACE("psnedf_scheduler_tick: " 113 TRACE("psnedf_scheduler_tick: "
113 "%d is preemptable " 114 "%d is preemptable "
114 " => FORCE_RESCHED\n", t->pid); 115 " => FORCE_RESCHED\n", t->pid);
@@ -204,6 +205,7 @@ static struct task_struct* psnedf_schedule(struct task_struct * prev)
204 } 205 }
205 206
206 pedf->scheduled = next; 207 pedf->scheduled = next;
208 sched_state_task_picked();
207 raw_spin_unlock(&pedf->slock); 209 raw_spin_unlock(&pedf->slock);
208 210
209 return next; 211 return next;