[patch] BFS 421: fix try_preempt

From: Hillf Danton
Date: Wed Jun 06 2012 - 09:20:16 EST


We have to keep deadline latest, so no update if not checked.

Alternatively we could try preempt in the following way,

rcu_read_lock();
for_each_domain(task_cpu(q), sd) {
for_each_cpu_and(cpu, tsk_cpus_allowed(p),
sched_domain_span(sd)) {
if (!cpu_online(cpu))
continue;
if (can_preempt(p, cpu_rq(cpu)->rq_prio,
cpu_rq(cpu)->rq_deadline)) {
resched_task(cpu_rq(cpu)->curr);
goto out;
}
}
}
out:
rcu_read_unlock();


where the upside is that the LLC is invovled, and the downside is that we are
not sure the preempted task has the highest priority and the latest deadline.

What to do next?


--- a/kernel/sched/bfs.c Wed Jun 6 20:14:36 2012
+++ b/kernel/sched/bfs.c Wed Jun 6 20:16:48 2012
@@ -1452,10 +1452,11 @@ static void try_preempt(struct task_stru
if (rq_prio < highest_prio)
continue;

- if (rq_prio > highest_prio ||
- deadline_after(rq->rq_deadline, latest_deadline)) {
+ if (rq_prio > highest_prio)
+ goto set;
+ if (deadline_after(rq->rq_deadline, latest_deadline)) {
latest_deadline = rq->rq_deadline;
- highest_prio = rq_prio;
+set: highest_prio = rq_prio;
highest_prio_rq = rq;
}
}
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/