aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_cedf.c
diff options
context:
space:
mode:
Diffstat (limited to 'litmus/sched_cedf.c')
-rw-r--r--litmus/sched_cedf.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index e78ff0ade237..99f7620925ba 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -504,7 +504,6 @@ static void do_lit_tasklets(cedf_domain_t* cluster, struct task_struct* sched_ta
504 504
505 TS_NV_SCHED_BOTISR_START; 505 TS_NV_SCHED_BOTISR_START;
506 506
507 // remove tasklet at head of list if it has higher priority.
508 raw_spin_lock_irqsave(&cluster->cluster_lock, flags); 507 raw_spin_lock_irqsave(&cluster->cluster_lock, flags);
509 508
510 if(cluster->pending_tasklets.head != NULL) { 509 if(cluster->pending_tasklets.head != NULL) {
@@ -512,25 +511,35 @@ static void do_lit_tasklets(cedf_domain_t* cluster, struct task_struct* sched_ta
512 struct tasklet_struct *prev = NULL; 511 struct tasklet_struct *prev = NULL;
513 tasklet = cluster->pending_tasklets.head; 512 tasklet = cluster->pending_tasklets.head;
514 513
515 while(tasklet && edf_higher_prio(sched_task, tasklet->owner)) { 514 // find a tasklet with prio to execute; skip ones where
515 // sched_task has a higher priority.
516 // We use the '!edf' test instead of swaping function arguments since
517 // both sched_task and owner could be NULL. In this case, we want to
518 // still execute the tasklet.
519 while(tasklet && !edf_higher_prio(tasklet->owner, sched_task)) {
516 prev = tasklet; 520 prev = tasklet;
517 tasklet = tasklet->next; 521 tasklet = tasklet->next;
518 } 522 }
519 523
520 // remove the tasklet from the queue 524 if(tasklet) { // found something to execuite
521 if(prev) { 525 // remove the tasklet from the queue
522 prev->next = tasklet->next; 526 if(prev) {
523 if(prev->next == NULL) { 527 prev->next = tasklet->next;
524 TRACE("%s: Tasklet for %d is the last element in tasklet queue.\n", __FUNCTION__, tasklet->owner->pid); 528 if(prev->next == NULL) {
525 cluster->pending_tasklets.tail = &(prev); 529 TRACE("%s: Tasklet for %d is the last element in tasklet queue.\n", __FUNCTION__, tasklet->owner->pid);
530 cluster->pending_tasklets.tail = &(prev);
531 }
532 }
533 else {
534 cluster->pending_tasklets.head = tasklet->next;
535 if(tasklet->next == NULL) {
536 TRACE("%s: Tasklet for %d is the last element in tasklet queue.\n", __FUNCTION__, tasklet->owner->pid);
537 cluster->pending_tasklets.tail = &(cluster->pending_tasklets.head);
538 }
526 } 539 }
527 } 540 }
528 else { 541 else {
529 cluster->pending_tasklets.head = tasklet->next; 542 TRACE("%s: No tasklets with eligible priority.\n", __FUNCTION__);
530 if(tasklet->next == NULL) {
531 TRACE("%s: Tasklet for %d is the last element in tasklet queue.\n", __FUNCTION__, tasklet->owner->pid);
532 cluster->pending_tasklets.tail = &(cluster->pending_tasklets.head);
533 }
534 } 543 }
535 } 544 }
536 else { 545 else {
@@ -629,6 +638,7 @@ static void cedf_run_tasklets(struct task_struct* sched_task)
629 638
630static int cedf_enqueue_pai_tasklet(struct tasklet_struct* tasklet) 639static int cedf_enqueue_pai_tasklet(struct tasklet_struct* tasklet)
631{ 640{
641#if 0
632 cedf_domain_t *cluster = NULL; 642 cedf_domain_t *cluster = NULL;
633 cpu_entry_t *targetCPU = NULL; 643 cpu_entry_t *targetCPU = NULL;
634 int thisCPU; 644 int thisCPU;
@@ -709,7 +719,10 @@ static int cedf_enqueue_pai_tasklet(struct tasklet_struct* tasklet)
709 else { 719 else {
710 TRACE("%s: Scheduling of tasklet was deferred.\n", __FUNCTION__); 720 TRACE("%s: Scheduling of tasklet was deferred.\n", __FUNCTION__);
711 } 721 }
712 722#else
723 TRACE("%s: Running tasklet on CPU where it was received.\n", __FUNCTION__);
724 __do_lit_tasklet(tasklet, 0ul);
725#endif
713 return(1); // success 726 return(1); // success
714} 727}
715 728