Commit 3be209a8e22cedafc1b6945608b7bb8d9887ab61

Authored by Shawn Bohrer
Committed by Ingo Molnar
1 parent 003f6c9df5

sched/rt: Migrate equal priority tasks to available CPUs

Commit 43fa5460fe60dea5c610490a1d263415419c60f6 ("sched: Try not to
migrate higher priority RT tasks") also introduced a change in behavior
which keeps RT tasks on the same CPU if there is an equal priority RT
task currently running even if there are empty CPUs available.

This can cause unnecessary wakeup latencies, and can prevent the
scheduler from balancing all RT tasks across available CPUs.

This change causes an RT task to search for a new CPU if an equal
priority RT task is already running on wakeup.  Lower priority tasks
will still have to wait on higher priority tasks, but the system should
still balance out because there is always the possibility that if there
are both a high and low priority RT tasks on a given CPU that the high
priority task could wakeup while the low priority task is running and
force it to search for a better runqueue.

Signed-off-by: Shawn Bohrer <sbohrer@rgmadvisors.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Tested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: stable@kernel.org # 37+
Link: http://lkml.kernel.org/r/1315837684-18733-1-git-send-email-sbohrer@rgmadvisors.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

... ... @@ -1050,7 +1050,7 @@
1050 1050 */
1051 1051 if (curr && unlikely(rt_task(curr)) &&
1052 1052 (curr->rt.nr_cpus_allowed < 2 ||
1053   - curr->prio < p->prio) &&
  1053 + curr->prio <= p->prio) &&
1054 1054 (p->rt.nr_cpus_allowed > 1)) {
1055 1055 int target = find_lowest_rq(p);
1056 1056  
... ... @@ -1581,7 +1581,7 @@
1581 1581 p->rt.nr_cpus_allowed > 1 &&
1582 1582 rt_task(rq->curr) &&
1583 1583 (rq->curr->rt.nr_cpus_allowed < 2 ||
1584   - rq->curr->prio < p->prio))
  1584 + rq->curr->prio <= p->prio))
1585 1585 push_rt_tasks(rq);
1586 1586 }
1587 1587