aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2013-09-27 13:53:31 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2014-02-19 15:33:40 -0500
commitc99faf7a7afc4ff013628fa4321e590d8bb1aecb (patch)
tree915d252c3abb9cbb1d229fd693b5d5695c79d980 /litmus
parentbb55630f8b8e0afc5e53ec20d71e0cd3a18913b2 (diff)
Add PGM support to C-EDF.
Patch adds PGM priority boosting (and un-boosting) to C-EDF.
Diffstat (limited to 'litmus')
-rw-r--r--litmus/sched_cedf.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index babf8d932acb..95b2dc3bea55 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -48,6 +48,10 @@
48#include <litmus/affinity.h> 48#include <litmus/affinity.h>
49#endif 49#endif
50 50
51#ifdef CONFIG_SCHED_PGM
52#include <litmus/pgm.h>
53#endif
54
51/* to configure the cluster size */ 55/* to configure the cluster size */
52#include <litmus/litmus_proc.h> 56#include <litmus/litmus_proc.h>
53#include <linux/uaccess.h> 57#include <linux/uaccess.h>
@@ -459,6 +463,42 @@ static struct task_struct* cedf_schedule(struct task_struct * prev)
459 TRACE_TASK(prev, "will be preempted by %s/%d\n", 463 TRACE_TASK(prev, "will be preempted by %s/%d\n",
460 entry->linked->comm, entry->linked->pid); 464 entry->linked->comm, entry->linked->pid);
461 465
466#ifdef CONFIG_SCHED_PGM
467 if (exists && is_pgm_waiting(entry->scheduled)) {
468 if (!is_priority_boosted(entry->scheduled)) {
469 TRACE_TASK(entry->scheduled, "is waiting for PGM tokens.\n");
470 BUG_ON(is_pgm_satisfied(entry->scheduled));
471
472 /* Boost priority so we'll be scheduled immediately
473 when needed tokens arrive. */
474 tsk_rt(entry->scheduled)->priority_boosted = 1;
475 tsk_rt(entry->scheduled)->boost_start_time = litmus_clock();
476
477 if (unlikely(!blocks)) {
478 /* Task has probably blocked on an inbound token socket, but
479 if not, re-evaluate scheduling decisions */
480 unlink(entry->scheduled);
481 cedf_job_arrival(entry->scheduled);
482 }
483 }
484 else if (is_pgm_satisfied(entry->scheduled)) {
485 TRACE_TASK(entry->scheduled, "is done waiting for PGM tokens.\n");
486 BUG_ON(!is_priority_boosted(entry->scheduled));
487
488 /* clear any boosting */
489 tsk_rt(entry->scheduled)->priority_boosted = 0;
490 setup_pgm_release(entry->scheduled);
491
492 if (likely(!blocks)) {
493 /* Task has probably called sched_yield(), so blocking is
494 unlikely. Re-evaluate scheduling decisions because we
495 still want to run. */
496 unlink(entry->scheduled);
497 cedf_job_arrival(entry->scheduled);
498 }
499 }
500 }
501#endif
462 502
463 /* If a task blocks we have no choice but to reschedule. 503 /* If a task blocks we have no choice but to reschedule.
464 */ 504 */