From e1ab93add217944741e21d44a49b7f9a76af4442 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Mon, 25 Jul 2011 11:42:07 -0400 Subject: P-FP: support job migrations When scheduling, make sure the currently scheduled task still belongs to this partition. --- litmus/sched_pfp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/litmus/sched_pfp.c b/litmus/sched_pfp.c index b59435e4e338..c6cd44183fbb 100644 --- a/litmus/sched_pfp.c +++ b/litmus/sched_pfp.c @@ -148,8 +148,7 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) pfp_domain_t* pfp = local_pfp; struct task_struct* next; - int out_of_time, sleep, preempt, - np, exists, blocks, resched; + int out_of_time, sleep, preempt, np, exists, blocks, resched, migrate; raw_spin_lock(&pfp->slock); @@ -168,7 +167,8 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) budget_exhausted(pfp->scheduled); np = exists && is_np(pfp->scheduled); sleep = exists && get_rt_flags(pfp->scheduled) == RT_F_SLEEP; - preempt = fp_preemption_needed(&pfp->ready_queue, prev); + migrate = exists && get_partition(pfp->scheduled) != pfp->cpu; + preempt = migrate || fp_preemption_needed(&pfp->ready_queue, prev); /* If we need to preempt do so. * The following checks set resched to 1 in case of special @@ -191,7 +191,7 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) * budget or wants to sleep completes. We may have to reschedule after * this. */ - if (!np && (out_of_time || sleep) && !blocks) { + if (!np && (out_of_time || sleep) && !blocks && !migrate) { job_completion(pfp->scheduled, !sleep); resched = 1; } @@ -207,7 +207,7 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) * release queue (if it completed). requeue() picks * the appropriate queue. */ - if (pfp->scheduled && !blocks) + if (pfp->scheduled && !blocks && !migrate) requeue(pfp->scheduled, pfp); next = fp_prio_take(&pfp->ready_queue); } else -- cgit v1.2.2