aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_gsn_edf.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2009-12-17 21:47:19 -0500
committerAndrea Bastoni <bastoni@cs.unc.edu>2009-12-17 21:47:19 -0500
commit3d6e88ccd9fbb6f96a8bb3af09bdfbb151f353e4 (patch)
tree75313c0cb7099b170d531bd408365692df51e8db /litmus/sched_gsn_edf.c
parent58054c96a3e5cb03a1ffa13a42caf877f0152a37 (diff)
Add release-master support
Diffstat (limited to 'litmus/sched_gsn_edf.c')
-rw-r--r--litmus/sched_gsn_edf.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c
index 69990805e16a..a223e69f2efb 100644
--- a/litmus/sched_gsn_edf.c
+++ b/litmus/sched_gsn_edf.c
@@ -393,6 +393,12 @@ static struct task_struct* gsnedf_schedule(struct task_struct * prev)
393 int out_of_time, sleep, preempt, np, exists, blocks; 393 int out_of_time, sleep, preempt, np, exists, blocks;
394 struct task_struct* next = NULL; 394 struct task_struct* next = NULL;
395 395
396 /* Bail out early if we are the release master.
397 * The release master never schedules any real-time tasks.
398 */
399 if (gsnedf.release_master == entry->cpu)
400 return NULL;
401
396 spin_lock(&gsnedf_lock); 402 spin_lock(&gsnedf_lock);
397 clear_will_schedule(); 403 clear_will_schedule();
398 404
@@ -515,8 +521,15 @@ static void gsnedf_task_new(struct task_struct * t, int on_rq, int running)
515 if (running) { 521 if (running) {
516 entry = &per_cpu(gsnedf_cpu_entries, task_cpu(t)); 522 entry = &per_cpu(gsnedf_cpu_entries, task_cpu(t));
517 BUG_ON(entry->scheduled); 523 BUG_ON(entry->scheduled);
518 entry->scheduled = t; 524
519 tsk_rt(t)->scheduled_on = task_cpu(t); 525 if (entry->cpu != gsnedf.release_master) {
526 entry->scheduled = t;
527 tsk_rt(t)->scheduled_on = task_cpu(t);
528 } else {
529 /* do not schedule on release master */
530 preempt(entry); /* force resched */
531 tsk_rt(t)->scheduled_on = NO_CPU;
532 }
520 } else { 533 } else {
521 t->rt_param.scheduled_on = NO_CPU; 534 t->rt_param.scheduled_on = NO_CPU;
522 } 535 }
@@ -758,6 +771,7 @@ static long gsnedf_activate_plugin(void)
758 cpu_entry_t *entry; 771 cpu_entry_t *entry;
759 772
760 heap_init(&gsnedf_cpu_heap); 773 heap_init(&gsnedf_cpu_heap);
774 gsnedf.release_master = atomic_read(&release_master_cpu);
761 775
762 for_each_online_cpu(cpu) { 776 for_each_online_cpu(cpu) {
763 entry = &per_cpu(gsnedf_cpu_entries, cpu); 777 entry = &per_cpu(gsnedf_cpu_entries, cpu);
@@ -765,8 +779,12 @@ static long gsnedf_activate_plugin(void)
765 atomic_set(&entry->will_schedule, 0); 779 atomic_set(&entry->will_schedule, 0);
766 entry->linked = NULL; 780 entry->linked = NULL;
767 entry->scheduled = NULL; 781 entry->scheduled = NULL;
768 TRACE("GSN-EDF: Initializing CPU #%d.\n", cpu); 782 if (cpu != gsnedf.release_master) {
769 update_cpu_position(entry); 783 TRACE("GSN-EDF: Initializing CPU #%d.\n", cpu);
784 update_cpu_position(entry);
785 } else {
786 TRACE("GSN-EDF: CPU %d is release master.\n", cpu);
787 }
770 } 788 }
771 return 0; 789 return 0;
772} 790}