aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-06-08 06:22:59 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-06-25 03:37:37 -0400
commit12dab1d22770b58ae174c46dc292a4dfb0e01452 (patch)
tree7b47da2512633b8e2653ff88d7d86c7434d3e4c1
parentb46ddf5d187d603f72389ac047a99e80edb6285d (diff)
GSN-EDF: link tasks to local CPU if it is idle
If a task is released on a CPU that is idle, then it is pointless to send an IPI to another CPU just to schedule the newly released task. This patch changes check_for_preemptions() to prefer the local CPU first if it is idle.
-rw-r--r--litmus/sched_gsn_edf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c
index 5a63ef1c580f..3bf484c3f857 100644
--- a/litmus/sched_gsn_edf.c
+++ b/litmus/sched_gsn_edf.c
@@ -280,6 +280,18 @@ static void check_for_preemptions(void)
280{ 280{
281 struct task_struct *task; 281 struct task_struct *task;
282 cpu_entry_t *last; 282 cpu_entry_t *last;
283 cpu_entry_t *local;
284
285 /* Before linking to other CPUs, check first whether the local CPU is
286 * idle. */
287 local = &__get_cpu_var(gsnedf_cpu_entries);
288 task = __peek_ready(&gsnedf);
289 if (task && !local->linked) {
290 task = __take_ready(&gsnedf);
291 TRACE_TASK(task, "linking to local CPU %d to avoid IPI\n", local->cpu);
292 link_task_to_cpu(task, local);
293 preempt(local);
294 }
283 295
284 for (last = lowest_prio_cpu(); 296 for (last = lowest_prio_cpu();
285 edf_preemption_needed(&gsnedf, last->linked); 297 edf_preemption_needed(&gsnedf, last->linked);