aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2011-09-23 11:24:09 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2011-09-23 11:24:09 -0400
commit334e08aeedcab61faca6be333e065c33098a8cda (patch)
treebd35ea7960c2bc8fc7c7371ea857605187d53ac7 /litmus
parent20f73d107d2df207693815f6ca4214e065b0563b (diff)
Checkpoint commit for work redistribution
Diffstat (limited to 'litmus')
-rw-r--r--litmus/sched_mc.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c
index fa2cd7ee606b..6ece904ff257 100644
--- a/litmus/sched_mc.c
+++ b/litmus/sched_mc.c
@@ -83,6 +83,7 @@ static int interrupt_cpu;
83#define domain_data(dom) (container_of(dom, domain_data_t, domain)) 83#define domain_data(dom) (container_of(dom, domain_data_t, domain))
84#define is_global(dom) (domain_data(dom)->heap) 84#define is_global(dom) (domain_data(dom)->heap)
85#define is_global_task(t) (is_global(get_task_domain(t))) 85#define is_global_task(t) (is_global(get_task_domain(t)))
86#define is_in_list(t) (tsk_rt(t)->list.next != tsk_rt(t)->list)
86#define can_requeue(t) \ 87#define can_requeue(t) \
87 (!is_global_task(t) || (t)->rt_param.scheduled_on == NO_CPU) 88 (!is_global_task(t) || (t)->rt_param.scheduled_on == NO_CPU)
88#define entry_level(e) \ 89#define entry_level(e) \
@@ -243,10 +244,11 @@ static void job_arrival(struct task_struct *task)
243 244
244 TRACE_TASK(task, "Job arriving"); 245 TRACE_TASK(task, "Job arriving");
245 BUG_ON(!task); 246 BUG_ON(!task);
246 raw_spin_lock(dom->lock);
247 if (can_requeue(task)) { 247 if (can_requeue(task)) {
248 raw_spin_lock(dom->lock);
248 dom->requeue(dom, task); 249 dom->requeue(dom, task);
249 check_for_preempt(dom); 250 check_for_preempt(dom);
251 raw_spin_unlock(dom->lock);
250 } else { 252 } else {
251 /* If a global task is scheduled on one cpu, it CANNOT 253 /* If a global task is scheduled on one cpu, it CANNOT
252 * be requeued into a global domain. Another cpu might 254 * be requeued into a global domain. Another cpu might
@@ -256,9 +258,10 @@ static void job_arrival(struct task_struct *task)
256 */ 258 */
257 TRACE_TASK(task, "Delayed arrival of scheduled task"); 259 TRACE_TASK(task, "Delayed arrival of scheduled task");
258 } 260 }
259 raw_spin_unlock(dom->lock);
260} 261}
261 262
263static void 1
264
262/** 265/**
263 * link_task_to_cpu() - Logically run a task on a CPU. 266 * link_task_to_cpu() - Logically run a task on a CPU.
264 * The task must first have been linked to one of the CPU's crit_entries. 267 * The task must first have been linked to one of the CPU's crit_entries.
@@ -320,12 +323,15 @@ static void fix_global_levels(void)
320 struct list_head *pos, *safe; 323 struct list_head *pos, *safe;
321 struct task_struct *t; 324 struct task_struct *t;
322 325
326 TRACE("Fixing global levels\n");
323 for_each_online_cpu(c) { 327 for_each_online_cpu(c) {
324 e = cpus[c]; 328 e = cpus[c];
325 raw_spin_lock(&e->redir_lock); 329 raw_spin_lock(&e->redir_lock);
326 list_for_each_safe(pos, safe, &e->redir) { 330 list_for_each_safe(pos, safe, &e->redir) {
327 t = list_entry(pos, struct task_struct, rt_param.list); 331 t = list_entry(pos, struct task_struct, rt_param.list);
328 list_del(pos); 332 TRACE_TASK(t, "Arriving yo");
333 BUG_ON(is_queued(t));
334 list_del_init(pos);
329 job_arrival(t); 335 job_arrival(t);
330 } 336 }
331 raw_spin_unlock(&e->redir_lock); 337 raw_spin_unlock(&e->redir_lock);
@@ -361,20 +367,7 @@ static void update_crit_levels(cpu_entry_t *entry)
361 ce = &entry->crit_entries[i]; 367 ce = &entry->crit_entries[i];
362 TRACE("Checking %s\n", ce->domain->name); 368 TRACE("Checking %s\n", ce->domain->name);
363 if (!tasks[i]) continue; 369 if (!tasks[i]) continue;
364#ifdef CONFIG_PLUGIN_MC_REDIRECT
365#ifndef CONFIG_PLUGIN_MC_REDIRECT_ALL
366 if (!is_global_task(tasks[i]))
367 job_arrival(tasks[i]);
368 else
369#endif
370 {
371 raw_spin_lock(&entry->redir_lock);
372 list_add(&tsk_rt(tasks[i])->list, &entry->redir);
373 raw_spin_unlock(&entry->redir_lock);
374 }
375#else
376 job_arrival(tasks[i]); 370 job_arrival(tasks[i]);
377#endif
378 } 371 }
379} 372}
380 373