aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_litmus.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_litmus.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_litmus.c')
-rw-r--r--litmus/sched_litmus.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/litmus/sched_litmus.c b/litmus/sched_litmus.c
index 65873152e68f..e6952896dc4b 100644
--- a/litmus/sched_litmus.c
+++ b/litmus/sched_litmus.c
@@ -3,6 +3,7 @@
3#include <litmus/litmus.h> 3#include <litmus/litmus.h>
4#include <litmus/budget.h> 4#include <litmus/budget.h>
5#include <litmus/sched_plugin.h> 5#include <litmus/sched_plugin.h>
6#include <litmus/preempt.h>
6 7
7static void update_time_litmus(struct rq *rq, struct task_struct *p) 8static void update_time_litmus(struct rq *rq, struct task_struct *p)
8{ 9{
@@ -52,6 +53,8 @@ litmus_schedule(struct rq *rq, struct task_struct *prev)
52 /* let the plugin schedule */ 53 /* let the plugin schedule */
53 next = litmus->schedule(prev); 54 next = litmus->schedule(prev);
54 55
56 sched_state_plugin_check();
57
55 /* check if a global plugin pulled a task from a different RQ */ 58 /* check if a global plugin pulled a task from a different RQ */
56 if (next && task_rq(next) != rq) { 59 if (next && task_rq(next) != rq) {
57 /* we need to migrate the task */ 60 /* we need to migrate the task */
@@ -198,7 +201,7 @@ static void yield_task_litmus(struct rq *rq)
198 * then determine if a preemption is still required. 201 * then determine if a preemption is still required.
199 */ 202 */
200 clear_exit_np(current); 203 clear_exit_np(current);
201 set_tsk_need_resched(current); 204 litmus_reschedule_local();
202} 205}
203 206
204/* Plugins are responsible for this. 207/* Plugins are responsible for this.