diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-09-27 13:53:31 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-09-27 13:55:15 -0400 |
commit | f5bf97f1f5345f7e8aef2b99ec0d57ddd081c1d2 (patch) | |
tree | d0f6515ad679d27e945dc7e92f17e79fba862a51 | |
parent | a62f9db5b5e183287bffd7f1ece26225f6ed1d61 (diff) |
Add PGM support to C-EDF.
Patch adds PGM priority boosting (and un-boosting) to C-EDF.
-rw-r--r-- | litmus/sched_cedf.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c index 7cb3cc07ed21..b6bed80133f7 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 | */ |