aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2010-09-21 23:25:14 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-09-21 23:25:14 -0400
commitc157675b9d4ceb268e38cc80e99c46d73042d409 (patch)
tree948f98e4e2abf0a083855c8ae7884a59c2bdbaf3 /litmus
parent7b4a10031257415b0ff1c03a77ac33555eeed8fe (diff)
EDF-WM: add parameter checking to wm_admit_task
Diffstat (limited to 'litmus')
-rw-r--r--litmus/sched_edf_wm.c60
1 files changed, 58 insertions, 2 deletions
diff --git a/litmus/sched_edf_wm.c b/litmus/sched_edf_wm.c
index 135f618db6b3..4700c77a886a 100644
--- a/litmus/sched_edf_wm.c
+++ b/litmus/sched_edf_wm.c
@@ -400,9 +400,65 @@ static void wm_task_exit(struct task_struct * t)
400 raw_spin_unlock_irqrestore(&dom->slock, flags); 400 raw_spin_unlock_irqrestore(&dom->slock, flags);
401} 401}
402 402
403static long wm_admit_task(struct task_struct* tsk) 403static long wm_check_params(struct task_struct *t)
404{ 404{
405 return task_cpu(tsk) == tsk->rt_param.task_params.cpu ? 0 : -EINVAL; 405 struct rt_param* p = tsk_rt(t);
406 struct edf_wm_params* wm = &p->task_params.semi_part.wm;
407 int i;
408 lt_t tmp;
409
410 if (!is_sliced_task(t))
411 /* regular task; nothing to check */
412 return 0;
413
414 /* (1) Either not sliced, or more than 1 slice. */
415 if (wm->count == 1 || wm->count > MAX_EDF_WM_SLICES)
416 return -EINVAL;
417
418 /* (2) The partition has to agree with the first slice. */
419 if (get_partition(t) != wm->slices[0].cpu)
420 return -EINVAL;
421
422 /* (3) The total budget must agree. */
423 for (i = 0, tmp = 0; i < wm->count; i++)
424 tmp += wm->slices[i].budget;
425 if (get_exec_cost(t) != tmp)
426 return -EINVAL;
427
428 /* (4) The release of each slice must not precede the previous
429 * deadline. */
430 for (i = 0; i < wm->count - 1; i++)
431 if (wm->slices[i].deadline > wm->slices[i + 1].offset)
432 return -EINVAL;
433
434 /* (5) The budget of each slice must fit within [offset, deadline] */
435 for (i = 0; i < wm->count; i++)
436 if (lt_before(wm->slices[i].deadline, wm->slices[i].offset) ||
437 wm->slices[i].deadline - wm->slices[i].offset <
438 wm->slices[i].budget)
439 return -EINVAL;
440
441 /* (6) The budget of each slice must exceed the minimum budget size. */
442 for (i = 0; i < wm->count; i++)
443 if (wm->slices[i].budget < MIN_EDF_WM_SLICE_SIZE)
444 return -EINVAL;
445
446 /* (7) The CPU of each slice must be different from the previous CPU. */
447 for (i = 0; i < wm->count - 1; i++)
448 if (wm->slices[i].cpu == wm->slices[i + 1].cpu)
449 return -EINVAL;
450
451 /* (8) The CPU of each slice must be online. */
452 for (i = 0; i < wm->count; i++)
453 if (!cpu_online(wm->slices[i].cpu))
454 return -EINVAL;
455
456 return 0;
457}
458
459static long wm_admit_task(struct task_struct* t)
460{
461 return task_cpu(t) == get_partition(t) ? wm_check_params(t) : -EINVAL;
406} 462}
407 463
408/* Plugin object */ 464/* Plugin object */