diff options
author | Mac Mollison <mollison@cs.unc.edu> | 2010-11-03 16:12:54 -0400 |
---|---|---|
committer | Mac Mollison <mollison@cs.unc.edu> | 2010-11-03 16:14:47 -0400 |
commit | f4686b9c19218c2f273bc459120196a952c6bcac (patch) | |
tree | 17e55ed3f9950b88e05e15f9400da5bcc9b958af | |
parent | d776a3d457e424003b0e0db429a02034c3ab7f24 (diff) |
Use an enum for criticality, instead of an int
-rw-r--r-- | litmus/sched_mc.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c index 636fa5750bd3..90b693fc44a5 100644 --- a/litmus/sched_mc.c +++ b/litmus/sched_mc.c | |||
@@ -256,7 +256,7 @@ static noinline void link_task_to_cpu(struct task_struct* linked, | |||
256 | 256 | ||
257 | BUG_ON(linked && !is_realtime(linked)); | 257 | BUG_ON(linked && !is_realtime(linked)); |
258 | BUG_ON(linked && is_realtime(linked) && | 258 | BUG_ON(linked && is_realtime(linked) && |
259 | (linked->rt_param.task_params.crit < 2) && | 259 | (linked->rt_param.task_params.crit < CRIT_LEVEL_C) && |
260 | (linked->rt_param.task_params.cpu != entry->cpu)); | 260 | (linked->rt_param.task_params.cpu != entry->cpu)); |
261 | 261 | ||
262 | /* Currently linked task is set to be unlinked. */ | 262 | /* Currently linked task is set to be unlinked. */ |
@@ -278,14 +278,16 @@ static noinline void link_task_to_cpu(struct task_struct* linked, | |||
278 | * wanted to link, we don't need to do the swap -- | 278 | * wanted to link, we don't need to do the swap -- |
279 | * we just link ourselves to the CPU and depend on | 279 | * we just link ourselves to the CPU and depend on |
280 | * the caller to get things right. | 280 | * the caller to get things right. |
281 | * | 281 | * |
282 | * We can only safely swap if neither task is | 282 | * We can only safely swap if neither task is |
283 | * partitioned. | 283 | * partitioned. |
284 | */ | 284 | */ |
285 | if (entry != sched && | 285 | if (entry != sched && |
286 | linked->rt_param.task_params.crit > 1 && | 286 | linked->rt_param.task_params.crit > |
287 | CRIT_LEVEL_B && | ||
287 | (!sched->linked || | 288 | (!sched->linked || |
288 | sched->linked->rt_param.task_params.crit > 1)){ | 289 | sched->linked->rt_param.task_params.crit > |
290 | CRIT_LEVEL_B)){ | ||
289 | TRACE_TASK(linked, | 291 | TRACE_TASK(linked, |
290 | "already scheduled on %d, updating link.\n", | 292 | "already scheduled on %d, updating link.\n", |
291 | sched->cpu); | 293 | sched->cpu); |
@@ -357,7 +359,7 @@ static noinline void requeue(struct task_struct* task) | |||
357 | BUG_ON(is_queued(task)); | 359 | BUG_ON(is_queued(task)); |
358 | /* Should never call on a level A task.*/ | 360 | /* Should never call on a level A task.*/ |
359 | /*Allowing this for now*/ | 361 | /*Allowing this for now*/ |
360 | /* BUG_ON(task->rt_param.task_params.crit == 0);*/ | 362 | /* BUG_ON(task->rt_param.task_params.crit == CRIT_LEVEL_A);*/ |
361 | 363 | ||
362 | if (is_released(task, litmus_clock())) | 364 | if (is_released(task, litmus_clock())) |
363 | __add_ready(proper_domain(task), task); | 365 | __add_ready(proper_domain(task), task); |
@@ -442,7 +444,7 @@ static void check_for_pedf_preemption(cpu_entry_t* entry) | |||
442 | link_task_to_cpu(task, entry); | 444 | link_task_to_cpu(task, entry); |
443 | preempt(entry); | 445 | preempt(entry); |
444 | } | 446 | } |
445 | 447 | ||
446 | } | 448 | } |
447 | 449 | ||
448 | /* mc_job_arrival: task is either resumed or released */ | 450 | /* mc_job_arrival: task is either resumed or released */ |
@@ -453,17 +455,17 @@ static noinline void mc_job_arrival(struct task_struct* task) | |||
453 | 455 | ||
454 | TRACE("mc_job_arrival triggered\n"); | 456 | TRACE("mc_job_arrival triggered\n"); |
455 | requeue(task); | 457 | requeue(task); |
456 | if (task->rt_param.task_params.crit == 0){ | 458 | if (task->rt_param.task_params.crit == CRIT_LEVEL_A){ |
457 | check_for_a_preemption(remote_cpu_entry(get_partition(task))); | 459 | check_for_a_preemption(remote_cpu_entry(get_partition(task))); |
458 | } | 460 | } |
459 | else if (task->rt_param.task_params.crit == 1){ | 461 | else if (task->rt_param.task_params.crit == CRIT_LEVEL_B){ |
460 | check_for_pedf_preemption(remote_cpu_entry( | 462 | check_for_pedf_preemption(remote_cpu_entry( |
461 | get_partition(task))); | 463 | get_partition(task))); |
462 | } | 464 | } |
463 | else if (task->rt_param.task_params.crit == 2){ | 465 | else if (task->rt_param.task_params.crit == CRIT_LEVEL_C){ |
464 | check_for_c_preemptions(); | 466 | check_for_c_preemptions(); |
465 | } | 467 | } |
466 | else if (task->rt_param.task_params.crit == 3){ | 468 | else if (task->rt_param.task_params.crit == CRIT_LEVEL_D){ |
467 | check_for_d_preemptions(); | 469 | check_for_d_preemptions(); |
468 | } | 470 | } |
469 | } | 471 | } |
@@ -477,7 +479,7 @@ static void mc_release_jobs(rt_domain_t* rt, struct bheap* tasks) | |||
477 | TRACE("mc_release_jobs triggered\n"); | 479 | TRACE("mc_release_jobs triggered\n"); |
478 | 480 | ||
479 | __merge_ready(rt, tasks); | 481 | __merge_ready(rt, tasks); |
480 | 482 | ||
481 | for (i = 0; i < NR_CPUS; i++){ | 483 | for (i = 0; i < NR_CPUS; i++){ |
482 | if (rt == remote_b_queue(i)){ | 484 | if (rt == remote_b_queue(i)){ |
483 | check_for_pedf_preemption(remote_cpu_entry(i)); | 485 | check_for_pedf_preemption(remote_cpu_entry(i)); |