aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_gsn_edf.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-09-10 14:50:12 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2012-09-10 14:50:12 -0400
commitf4260f81a68d170b1d3558b5447343224d918a45 (patch)
tree647b6490efe8a6157cf3a919ec62eb5c0784175a /litmus/sched_gsn_edf.c
parent893c8943ce5c5527f05ab7e9208d5a942d77d8b5 (diff)
parent6a225701acf7d79f292eeffcd99d6f00b02c180b (diff)
Merge remote-tracking branch 'github/prop/litmus-signals' into wip-gpu-rtas12
Conflicts: litmus/sched_gsn_edf.c
Diffstat (limited to 'litmus/sched_gsn_edf.c')
-rw-r--r--litmus/sched_gsn_edf.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c
index 11304d634661..83b2f04b1532 100644
--- a/litmus/sched_gsn_edf.c
+++ b/litmus/sched_gsn_edf.c
@@ -410,20 +410,28 @@ static noinline void job_completion(struct task_struct *t, int forced)
410 */ 410 */
411static void gsnedf_tick(struct task_struct* t) 411static void gsnedf_tick(struct task_struct* t)
412{ 412{
413 if (is_realtime(t) && budget_enforced(t) && budget_exhausted(t)) { 413 if (is_realtime(t) && budget_exhausted(t))
414 if (!is_np(t)) { 414 {
415 /* np tasks will be preempted when they become 415 if (budget_signalled(t) && !sigbudget_sent(t)) {
416 * preemptable again 416 /* signal exhaustion */
417 */ 417 send_sigbudget(t);
418 litmus_reschedule_local(); 418 }
419 TRACE("gsnedf_scheduler_tick: " 419
420 "%d is preemptable " 420 if (budget_enforced(t)) {
421 " => FORCE_RESCHED\n", t->pid); 421 if (!is_np(t)) {
422 } else if (is_user_np(t)) { 422 /* np tasks will be preempted when they become
423 TRACE("gsnedf_scheduler_tick: " 423 * preemptable again
424 "%d is non-preemptable, " 424 */
425 "preemption delayed.\n", t->pid); 425 litmus_reschedule_local();
426 request_exit_np(t); 426 TRACE("gsnedf_scheduler_tick: "
427 "%d is preemptable "
428 " => FORCE_RESCHED\n", t->pid);
429 } else if (is_user_np(t)) {
430 TRACE("gsnedf_scheduler_tick: "
431 "%d is non-preemptable, "
432 "preemption delayed.\n", t->pid);
433 request_exit_np(t);
434 }
427 } 435 }
428 } 436 }
429} 437}
@@ -764,7 +772,7 @@ static void gsnedf_change_prio_pai_tasklet(struct task_struct *old_prio,
764static struct task_struct* gsnedf_schedule(struct task_struct * prev) 772static struct task_struct* gsnedf_schedule(struct task_struct * prev)
765{ 773{
766 cpu_entry_t* entry = &__get_cpu_var(gsnedf_cpu_entries); 774 cpu_entry_t* entry = &__get_cpu_var(gsnedf_cpu_entries);
767 int out_of_time, sleep, preempt, np, exists, blocks; 775 int out_of_time, signal_budget, sleep, preempt, np, exists, blocks;
768 struct task_struct* next = NULL; 776 struct task_struct* next = NULL;
769 777
770#ifdef CONFIG_RELEASE_MASTER 778#ifdef CONFIG_RELEASE_MASTER
@@ -787,8 +795,13 @@ static struct task_struct* gsnedf_schedule(struct task_struct * prev)
787 /* (0) Determine state */ 795 /* (0) Determine state */
788 exists = entry->scheduled != NULL; 796 exists = entry->scheduled != NULL;
789 blocks = exists && !is_running(entry->scheduled); 797 blocks = exists && !is_running(entry->scheduled);
790 out_of_time = exists && budget_enforced(entry->scheduled) 798 out_of_time = exists &&
791 && budget_exhausted(entry->scheduled); 799 budget_enforced(entry->scheduled) &&
800 budget_exhausted(entry->scheduled);
801 signal_budget = exists &&
802 budget_signalled(entry->scheduled) &&
803 budget_exhausted(entry->scheduled) &&
804 !sigbudget_sent(entry->scheduled);
792 np = exists && is_np(entry->scheduled); 805 np = exists && is_np(entry->scheduled);
793 sleep = exists && get_rt_flags(entry->scheduled) == RT_F_SLEEP; 806 sleep = exists && get_rt_flags(entry->scheduled) == RT_F_SLEEP;
794 preempt = entry->scheduled != entry->linked; 807 preempt = entry->scheduled != entry->linked;
@@ -800,9 +813,9 @@ static struct task_struct* gsnedf_schedule(struct task_struct * prev)
800 /* 813 /*
801 if (exists) 814 if (exists)
802 TRACE_TASK(prev, 815 TRACE_TASK(prev,
803 "blocks:%d out_of_time:%d np:%d sleep:%d preempt:%d " 816 "blocks:%d out_of_time:%d signal_budget: %d np:%d sleep:%d preempt:%d "
804 "state:%d sig:%d\n", 817 "state:%d sig:%d\n",
805 blocks, out_of_time, np, sleep, preempt, 818 blocks, out_of_time, signal_budget, np, sleep, preempt,
806 prev->state, signal_pending(prev)); 819 prev->state, signal_pending(prev));
807 */ 820 */
808 821
@@ -810,6 +823,10 @@ static struct task_struct* gsnedf_schedule(struct task_struct * prev)
810 TRACE_TASK(prev, "will be preempted by %s/%d\n", 823 TRACE_TASK(prev, "will be preempted by %s/%d\n",
811 entry->linked->comm, entry->linked->pid); 824 entry->linked->comm, entry->linked->pid);
812 825
826 /* Send the signal that the budget has been exhausted */
827 if (signal_budget)
828 send_sigbudget(entry->scheduled);
829
813 /* If a task blocks we have no choice but to reschedule. 830 /* If a task blocks we have no choice but to reschedule.
814 */ 831 */
815 if (blocks) { 832 if (blocks) {