aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_edf_os.c
diff options
context:
space:
mode:
authorJeremy Erickson <jerickso@cs.unc.edu>2013-05-03 17:35:35 -0400
committerJeremy Erickson <jerickso@cs.unc.edu>2013-05-03 17:35:35 -0400
commit30ec11d932ed9317035d0e56c550ac1353911792 (patch)
treeb3360115a2d415f02ca86e5ca8176d05d196acf2 /litmus/sched_edf_os.c
parentc622ef53527c961a83c5c2dd0dc9b8c9c450a0be (diff)
Add some debugging, correctness, and style improvements
Diffstat (limited to 'litmus/sched_edf_os.c')
-rw-r--r--litmus/sched_edf_os.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/litmus/sched_edf_os.c b/litmus/sched_edf_os.c
index ba049adc8154..a4b3cdeb1a07 100644
--- a/litmus/sched_edf_os.c
+++ b/litmus/sched_edf_os.c
@@ -287,10 +287,10 @@ static int next_cpu_for_job(struct task_struct *t)
287 /* Process any new subtask releases. */ 287 /* Process any new subtask releases. */
288 node = bheap_peek(fakepfair_ready_order, 288 node = bheap_peek(fakepfair_ready_order,
289 &edfos_params(t).release_queue); 289 &edfos_params(t).release_queue);
290 while (node && *((int*)node->value) <= tsk_rt(t)->job_params.job_no) 290 while (node && *((int*)node->value) <= tsk_rt(t)->job_params.job_no) {
291 {
292 node = bheap_take(fakepfair_ready_order, 291 node = bheap_take(fakepfair_ready_order,
293 &edfos_params(t).release_queue); 292 &edfos_params(t).release_queue);
293 BUG_ON(!node);
294 cpu = ((int*)node->value) - edfos_params(t).heap_data; 294 cpu = ((int*)node->value) - edfos_params(t).heap_data;
295 *((int*)node->value) = compute_pfair_deadline( 295 *((int*)node->value) = compute_pfair_deadline(
296 edfos_params(t).fraction[cpu][0], 296 edfos_params(t).fraction[cpu][0],
@@ -305,6 +305,7 @@ static int next_cpu_for_job(struct task_struct *t)
305 /* Choose the next Pfair subtask. */ 305 /* Choose the next Pfair subtask. */
306 node = bheap_take(fakepfair_ready_order, 306 node = bheap_take(fakepfair_ready_order,
307 &edfos_params(t).ready_queue); 307 &edfos_params(t).ready_queue);
308 BUG_ON(!node);
308 cpu = ((int*)node->value) - edfos_params(t).heap_data; 309 cpu = ((int*)node->value) - edfos_params(t).heap_data;
309 310
310 next_rel = compute_pfair_release(edfos_params(t).fraction[cpu][0], 311 next_rel = compute_pfair_release(edfos_params(t).fraction[cpu][0],
@@ -314,7 +315,7 @@ static int next_cpu_for_job(struct task_struct *t)
314 if (next_rel <= tsk_rt(t)->job_params.job_no) 315 if (next_rel <= tsk_rt(t)->job_params.job_no)
315 { 316 {
316 /* Next subtask already released. */ 317 /* Next subtask already released. */
317 (*(int*)node->value) = compute_pfair_deadline( 318 *((int*)node->value) = compute_pfair_deadline(
318 edfos_params(t).fraction[cpu][0], 319 edfos_params(t).fraction[cpu][0],
319 edfos_params(t).fraction[cpu][1], 320 edfos_params(t).fraction[cpu][1],
320 tsk_rt(t)->semi_part.cpu_job_no[cpu] + 321 tsk_rt(t)->semi_part.cpu_job_no[cpu] +
@@ -325,7 +326,7 @@ static int next_cpu_for_job(struct task_struct *t)
325 else 326 else
326 { 327 {
327 /* Next subtask not yet released. */ 328 /* Next subtask not yet released. */
328 (*(int*)node->value) = next_rel; 329 *((int*)node->value) = next_rel;
329 bheap_insert(fakepfair_ready_order, 330 bheap_insert(fakepfair_ready_order,
330 &edfos_params(t).release_queue, node); 331 &edfos_params(t).release_queue, node);
331 } 332 }
@@ -349,6 +350,7 @@ static void change_migrat_cpu_if_needed(struct task_struct *t)
349 * and the next release 350 * and the next release
350 */ 351 */
351 cpu = next_cpu_for_job(t); 352 cpu = next_cpu_for_job(t);
353 BUG();
352 if (unlikely(cpu != get_partition(t))) { 354 if (unlikely(cpu != get_partition(t))) {
353 tsk_rt(t)->task_params.cpu = cpu; 355 tsk_rt(t)->task_params.cpu = cpu;
354 TRACE_TASK(t, "EDF-os: will migrate job %d -> %d\n", 356 TRACE_TASK(t, "EDF-os: will migrate job %d -> %d\n",
@@ -482,21 +484,28 @@ static void edfos_task_new(struct task_struct * t, int on_rq, int running)
482 edfos_domain_t* edfos = task_edfos(t); 484 edfos_domain_t* edfos = task_edfos(t);
483 unsigned long flags; 485 unsigned long flags;
484 unsigned int i; 486 unsigned int i;
487 unsigned int has_cpu = 0;
485 488
486 for (i = 0; i < NR_CPUS; i++) 489 if (edfos_params(t).migrat) {
487 { 490 bheap_init(&edfos_params(t).release_queue);
488 if (edfos_params(t).fraction[i][0] > 0) 491 bheap_init(&edfos_params(t).ready_queue);
489 { 492 for (i = 0; i < NR_CPUS; i++) {
490 edfos_params(t).heap_data[i] = compute_pfair_deadline( 493 if (edfos_params(t).fraction[i][0] > 0) {
494 has_cpu = 1;
495 edfos_params(t).heap_data[i] =
496 compute_pfair_deadline(
491 edfos_params(t).fraction[i][0], 497 edfos_params(t).fraction[i][0],
492 edfos_params(t).fraction[i][1], 0); 498 edfos_params(t).fraction[i][1], 0);
493 bheap_add(fakepfair_ready_order, 499 bheap_add(fakepfair_ready_order,
494 &edfos_params(t).ready_queue, 500 &edfos_params(t).ready_queue,
495 &edfos_params(t).heap_data[i], GFP_ATOMIC); 501 &edfos_params(t).heap_data[i],
502 GFP_ATOMIC);
503 }
496 } 504 }
505 BUG_ON(!has_cpu);
506 /* Pick the first CPU to execute on. */
507 change_migrat_cpu_if_needed(t);
497 } 508 }
498 /* Pick the first CPU to execute on. */
499 change_migrat_cpu_if_needed(t);
500 509
501 TRACE_TASK(t, "EDF-os: task new, cpu = %d\n", 510 TRACE_TASK(t, "EDF-os: task new, cpu = %d\n",
502 t->rt_param.task_params.cpu); 511 t->rt_param.task_params.cpu);