From f4686b9c19218c2f273bc459120196a952c6bcac Mon Sep 17 00:00:00 2001 From: Mac Mollison Date: Wed, 3 Nov 2010 16:12:54 -0400 Subject: Use an enum for criticality, instead of an int --- litmus/sched_mc.c | 24 +++++++++++++----------- 1 file 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, BUG_ON(linked && !is_realtime(linked)); BUG_ON(linked && is_realtime(linked) && - (linked->rt_param.task_params.crit < 2) && + (linked->rt_param.task_params.crit < CRIT_LEVEL_C) && (linked->rt_param.task_params.cpu != entry->cpu)); /* Currently linked task is set to be unlinked. */ @@ -278,14 +278,16 @@ static noinline void link_task_to_cpu(struct task_struct* linked, * wanted to link, we don't need to do the swap -- * we just link ourselves to the CPU and depend on * the caller to get things right. - * + * * We can only safely swap if neither task is * partitioned. */ if (entry != sched && - linked->rt_param.task_params.crit > 1 && + linked->rt_param.task_params.crit > + CRIT_LEVEL_B && (!sched->linked || - sched->linked->rt_param.task_params.crit > 1)){ + sched->linked->rt_param.task_params.crit > + CRIT_LEVEL_B)){ TRACE_TASK(linked, "already scheduled on %d, updating link.\n", sched->cpu); @@ -357,7 +359,7 @@ static noinline void requeue(struct task_struct* task) BUG_ON(is_queued(task)); /* Should never call on a level A task.*/ /*Allowing this for now*/ -/* BUG_ON(task->rt_param.task_params.crit == 0);*/ +/* BUG_ON(task->rt_param.task_params.crit == CRIT_LEVEL_A);*/ if (is_released(task, litmus_clock())) __add_ready(proper_domain(task), task); @@ -442,7 +444,7 @@ static void check_for_pedf_preemption(cpu_entry_t* entry) link_task_to_cpu(task, entry); preempt(entry); } - + } /* mc_job_arrival: task is either resumed or released */ @@ -453,17 +455,17 @@ static noinline void mc_job_arrival(struct task_struct* task) TRACE("mc_job_arrival triggered\n"); requeue(task); - if (task->rt_param.task_params.crit == 0){ + if (task->rt_param.task_params.crit == CRIT_LEVEL_A){ check_for_a_preemption(remote_cpu_entry(get_partition(task))); } - else if (task->rt_param.task_params.crit == 1){ + else if (task->rt_param.task_params.crit == CRIT_LEVEL_B){ check_for_pedf_preemption(remote_cpu_entry( get_partition(task))); } - else if (task->rt_param.task_params.crit == 2){ + else if (task->rt_param.task_params.crit == CRIT_LEVEL_C){ check_for_c_preemptions(); } - else if (task->rt_param.task_params.crit == 3){ + else if (task->rt_param.task_params.crit == CRIT_LEVEL_D){ check_for_d_preemptions(); } } @@ -477,7 +479,7 @@ static void mc_release_jobs(rt_domain_t* rt, struct bheap* tasks) TRACE("mc_release_jobs triggered\n"); __merge_ready(rt, tasks); - + for (i = 0; i < NR_CPUS; i++){ if (rt == remote_b_queue(i)){ check_for_pedf_preemption(remote_cpu_entry(i)); -- cgit v1.2.2