aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_pfp.c
diff options
context:
space:
mode:
Diffstat (limited to 'litmus/sched_pfp.c')
-rw-r--r--litmus/sched_pfp.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/litmus/sched_pfp.c b/litmus/sched_pfp.c
index ad2b8d81f29f..891469054ab4 100644
--- a/litmus/sched_pfp.c
+++ b/litmus/sched_pfp.c
@@ -175,7 +175,7 @@ static void pfp_tick(struct task_struct *t)
175 tsk_rt(t)->budget.ops && budget_quantum_tracked(t) && 175 tsk_rt(t)->budget.ops && budget_quantum_tracked(t) &&
176 budget_exhausted(t)) { 176 budget_exhausted(t)) {
177 TRACE_TASK(t, "budget exhausted\n"); 177 TRACE_TASK(t, "budget exhausted\n");
178 tsk_rt(t)->budget.ops->on_exhausted(t); 178 budget_state_machine(t,on_exhausted);
179 } 179 }
180} 180}
181 181
@@ -213,14 +213,12 @@ static struct task_struct* pfp_schedule(struct task_struct * prev)
213 resched = preempt; 213 resched = preempt;
214 214
215 /* Do budget stuff */ 215 /* Do budget stuff */
216 if (tsk_rt(prev)->budget.ops) { 216 if (blocks)
217 if (blocks) 217 budget_state_machine(prev,on_blocked);
218 tsk_rt(prev)->budget.ops->on_blocked(prev); 218 else if (sleep)
219 else if (sleep) 219 budget_state_machine(prev,on_sleep);
220 tsk_rt(prev)->budget.ops->on_sleep(prev); 220 else if (preempt)
221 else if (preempt) 221 budget_state_machine(prev,on_preempt);
222 tsk_rt(prev)->budget.ops->on_preempt(prev);
223 }
224 222
225 /* If a task blocks we have no choice but to reschedule. 223 /* If a task blocks we have no choice but to reschedule.
226 */ 224 */
@@ -389,6 +387,8 @@ static void pfp_task_wake_up(struct task_struct *task)
389 sched_trace_task_release(task); 387 sched_trace_task_release(task);
390 } 388 }
391 389
390 budget_state_machine(task,on_wakeup);
391
392 /* Only add to ready queue if it is not the currently-scheduled 392 /* Only add to ready queue if it is not the currently-scheduled
393 * task. This could be the case if a task was woken up concurrently 393 * task. This could be the case if a task was woken up concurrently
394 * on a remote CPU before the executing CPU got around to actually 394 * on a remote CPU before the executing CPU got around to actually
@@ -436,8 +436,7 @@ static void pfp_task_exit(struct task_struct * t)
436 raw_readyq_lock_irqsave(&pfp->slock, flags); 436 raw_readyq_lock_irqsave(&pfp->slock, flags);
437 437
438 /* disable budget enforcement */ 438 /* disable budget enforcement */
439 if (tsk_rt(t)->budget.ops) 439 budget_state_machine(t,on_exit);
440 tsk_rt(t)->budget.ops->on_exit(t);
441 440
442 if (is_queued(t)) { 441 if (is_queued(t)) {
443 BUG(); /* This currently doesn't work. */ 442 BUG(); /* This currently doesn't work. */
@@ -485,8 +484,14 @@ static void fp_set_prio_inh(pfp_domain_t* pfp, struct task_struct* t,
485 /* first remove */ 484 /* first remove */
486 fp_dequeue(pfp, t); 485 fp_dequeue(pfp, t);
487 486
487 if (t->rt_param.inh_task)
488 budget_state_machine2(t,t->rt_param.inh_task,on_disinherit);
489
488 t->rt_param.inh_task = prio_inh; 490 t->rt_param.inh_task = prio_inh;
489 491
492 if (prio_inh)
493 budget_state_machine2(t,prio_inh,on_inherit);
494
490 if (requeue) 495 if (requeue)
491 /* add again to the right queue */ 496 /* add again to the right queue */
492 fp_prio_add(&pfp->ready_queue, t, priority_index(t)); 497 fp_prio_add(&pfp->ready_queue, t, priority_index(t));