aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_gsn_edf.c
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-08-07 03:47:05 -0400
commite3697ee7ecbcadf2ae4f17495ce46612c54fad13 (patch)
treedd88647a1432ecbdde7c827852c5b5f1f6b14a8d /litmus/sched_gsn_edf.c
parent9a169caf2081e6281e3f60ff86e1ea4af6faf78e (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.
Diffstat (limited to 'litmus/sched_gsn_edf.c')
-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 90ff6f639461..66ffa3e7a7bd 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);