aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2010-09-22 13:08:22 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-09-22 13:08:22 -0400
commit5a5e4ea245cbeffde9cdc3313b3dd5fbf585ec95 (patch)
treee2c8de4cadcde4c19af20a0c65f2f5ddb31833c8
parent23f83097b9aa69a09bab493baa7b2e67551878fe (diff)
EDF-WM: trace reasons why a task was rejected
Makes debugging easier.
-rw-r--r--litmus/sched_edf_wm.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/litmus/sched_edf_wm.c b/litmus/sched_edf_wm.c
index ba69969b9a1c..64a096bd02ca 100644
--- a/litmus/sched_edf_wm.c
+++ b/litmus/sched_edf_wm.c
@@ -521,46 +521,65 @@ static long wm_check_params(struct task_struct *t)
521 return 0; 521 return 0;
522 522
523 /* (1) Either not sliced, or more than 1 slice. */ 523 /* (1) Either not sliced, or more than 1 slice. */
524 if (wm->count == 1 || wm->count > MAX_EDF_WM_SLICES) 524 if (wm->count == 1 || wm->count > MAX_EDF_WM_SLICES) {
525 TRACE_TASK(t, "bad number of slices (%u) \n",
526 wm->count);
525 return -EINVAL; 527 return -EINVAL;
528 }
526 529
527 /* (2) The partition has to agree with the first slice. */ 530 /* (2) The partition has to agree with the first slice. */
528 if (get_partition(t) != wm->slices[0].cpu) 531 if (get_partition(t) != wm->slices[0].cpu) {
532 TRACE_TASK(t, "partition and first slice CPU differ\n");
529 return -EINVAL; 533 return -EINVAL;
534 }
530 535
531 /* (3) The total budget must agree. */ 536 /* (3) The total budget must agree. */
532 for (i = 0, tmp = 0; i < wm->count; i++) 537 for (i = 0, tmp = 0; i < wm->count; i++)
533 tmp += wm->slices[i].budget; 538 tmp += wm->slices[i].budget;
534 if (get_exec_cost(t) != tmp) 539 if (get_exec_cost(t) != tmp) {
540 TRACE_TASK(t, "total budget and sum of slice budgets differ\n");
535 return -EINVAL; 541 return -EINVAL;
542 }
536 543
537 /* (4) The release of each slice must not precede the previous 544 /* (4) The release of each slice must not precede the previous
538 * deadline. */ 545 * deadline. */
539 for (i = 0; i < wm->count - 1; i++) 546 for (i = 0; i < wm->count - 1; i++)
540 if (wm->slices[i].deadline > wm->slices[i + 1].offset) 547 if (wm->slices[i].deadline > wm->slices[i + 1].offset) {
548 TRACE_TASK(t, "slice %d overlaps with slice %d\n",
549 i, i + 1);
541 return -EINVAL; 550 return -EINVAL;
551 }
542 552
543 /* (5) The budget of each slice must fit within [offset, deadline] */ 553 /* (5) The budget of each slice must fit within [offset, deadline] */
544 for (i = 0; i < wm->count; i++) 554 for (i = 0; i < wm->count; i++)
545 if (lt_before(wm->slices[i].deadline, wm->slices[i].offset) || 555 if (lt_before(wm->slices[i].deadline, wm->slices[i].offset) ||
546 wm->slices[i].deadline - wm->slices[i].offset < 556 wm->slices[i].deadline - wm->slices[i].offset <
547 wm->slices[i].budget) 557 wm->slices[i].budget) {
558 TRACE_TASK(t, "slice %d is overloaded\n", i);
548 return -EINVAL; 559 return -EINVAL;
560 }
549 561
550 /* (6) The budget of each slice must exceed the minimum budget size. */ 562 /* (6) The budget of each slice must exceed the minimum budget size. */
551 for (i = 0; i < wm->count; i++) 563 for (i = 0; i < wm->count; i++)
552 if (wm->slices[i].budget < MIN_EDF_WM_SLICE_SIZE) 564 if (wm->slices[i].budget < MIN_EDF_WM_SLICE_SIZE) {
565 TRACE_TASK(t, "slice %d is too short\n", i);
553 return -EINVAL; 566 return -EINVAL;
567 }
554 568
555 /* (7) The CPU of each slice must be different from the previous CPU. */ 569 /* (7) The CPU of each slice must be different from the previous CPU. */
556 for (i = 0; i < wm->count - 1; i++) 570 for (i = 0; i < wm->count - 1; i++)
557 if (wm->slices[i].cpu == wm->slices[i + 1].cpu) 571 if (wm->slices[i].cpu == wm->slices[i + 1].cpu) {
572 TRACE_TASK(t, "slice %d does not migrate\n", i);
558 return -EINVAL; 573 return -EINVAL;
574 }
559 575
560 /* (8) The CPU of each slice must be online. */ 576 /* (8) The CPU of each slice must be online. */
561 for (i = 0; i < wm->count; i++) 577 for (i = 0; i < wm->count; i++)
562 if (!cpu_online(wm->slices[i].cpu)) 578 if (!cpu_online(wm->slices[i].cpu)) {
579 TRACE_TASK(t, "slice %d is allocated on offline CPU\n",
580 i);
563 return -EINVAL; 581 return -EINVAL;
582 }
564 583
565 return 0; 584 return 0;
566} 585}