Commit b3bc211cfe7d5fe94b310480d78e00bea96fbf2a
Committed by
Ingo Molnar
1 parent
43fa5460fe
Exists in
master
and in
7 other branches
sched: Give CPU bound RT tasks preference
If a high priority task is waking up on a CPU that is running a lower priority task that is bound to a CPU, see if we can move the high RT task to another CPU first. Note, if all other CPUs are running higher priority tasks than the CPU bounded current task, then it will be preempted regardless. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Gregory Haskins <ghaskins@novell.com> LKML-Reference: <20100921024138.888922071@goodmis.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 1 changed file with 5 additions and 3 deletions Side-by-side Diff
kernel/sched_rt.c
... | ... | @@ -971,7 +971,8 @@ |
971 | 971 | * For equal prio tasks, we just let the scheduler sort it out. |
972 | 972 | */ |
973 | 973 | if (unlikely(rt_task(rq->curr)) && |
974 | - rq->curr->prio < p->prio && | |
974 | + (rq->curr->rt.nr_cpus_allowed < 2 || | |
975 | + rq->curr->prio < p->prio) && | |
975 | 976 | (p->rt.nr_cpus_allowed > 1)) { |
976 | 977 | int cpu = find_lowest_rq(p); |
977 | 978 | |
978 | 979 | |
... | ... | @@ -1491,9 +1492,10 @@ |
1491 | 1492 | if (!task_running(rq, p) && |
1492 | 1493 | !test_tsk_need_resched(rq->curr) && |
1493 | 1494 | has_pushable_tasks(rq) && |
1495 | + p->rt.nr_cpus_allowed > 1 && | |
1494 | 1496 | rt_task(rq->curr) && |
1495 | - rq->curr->prio < p->prio && | |
1496 | - p->rt.nr_cpus_allowed > 1) | |
1497 | + (rq->curr->rt.nr_cpus_allowed < 2 || | |
1498 | + rq->curr->prio < p->prio)) | |
1497 | 1499 | push_rt_tasks(rq); |
1498 | 1500 | } |
1499 | 1501 |