From 9e6b747ce5c8ae700441d42d84c723832d91ecf8 Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Thu, 6 Sep 2012 14:40:15 +0200 Subject: P-FP: be paranoid in the preemption case Crash and burn if an expected preemption didn't happen. This is useful to flag any bugs in the queue management code... --- litmus/sched_pfp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litmus/sched_pfp.c b/litmus/sched_pfp.c index f69b6f61dfeb..2165e1c79df5 100644 --- a/litmus/sched_pfp.c +++ b/litmus/sched_pfp.c @@ -225,6 +225,11 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) if (pfp->scheduled && !blocks && !migrate) requeue(pfp->scheduled, pfp); next = fp_prio_take(&pfp->ready_queue); + /* If preempt is set, we should not see the same task again. */ + BUG_ON(preempt && next == prev); + /* Similarly, if preempt is set, then next may not be NULL, + * unless it's a migration. */ + BUG_ON(preempt && !migrate && next == NULL); } else /* Only override Linux scheduler if we have a real-time task * scheduled that needs to continue. -- cgit v1.2.2