Commit 39a4d9ca authored by Jason Low's avatar Jason Low Committed by Ingo Molnar

sched/fair: Stop searching for tasks in newidle balance if there are runnable tasks

It was found that when running some workloads (such as AIM7) on large
systems with many cores, CPUs do not remain idle for long. Thus, tasks
can wake/get enqueued while doing idle balancing.

In this patch, while traversing the domains in idle balance, in
addition to checking for pulled_task, we add an extra check for
this_rq->nr_running for determining if we should stop searching for
tasks to pull. If there are runnable tasks on this rq, then we will
stop traversing the domains. This reduces the chance that idle balance
delays a task from running.

This patch resulted in approximately a 6% performance improvement when
running a Java Server workload on an 8 socket machine.
Signed-off-by: default avatarJason Low <jason.low2@hp.com>
Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: daniel.lezcano@linaro.org
Cc: alex.shi@linaro.org
Cc: preeti@linux.vnet.ibm.com
Cc: efault@gmx.de
Cc: vincent.guittot@linaro.org
Cc: morten.rasmussen@arm.com
Cc: aswin@hp.com
Cc: chegu_vinod@hp.com
Link: http://lkml.kernel.org/r/1398303035-18255-4-git-send-email-jason.low2@hp.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent fb2aa855
...@@ -6713,7 +6713,6 @@ static int idle_balance(struct rq *this_rq) ...@@ -6713,7 +6713,6 @@ static int idle_balance(struct rq *this_rq)
if (sd->flags & SD_BALANCE_NEWIDLE) { if (sd->flags & SD_BALANCE_NEWIDLE) {
t0 = sched_clock_cpu(this_cpu); t0 = sched_clock_cpu(this_cpu);
/* If we've pulled tasks over stop searching: */
pulled_task = load_balance(this_cpu, this_rq, pulled_task = load_balance(this_cpu, this_rq,
sd, CPU_NEWLY_IDLE, sd, CPU_NEWLY_IDLE,
&continue_balancing); &continue_balancing);
...@@ -6728,7 +6727,12 @@ static int idle_balance(struct rq *this_rq) ...@@ -6728,7 +6727,12 @@ static int idle_balance(struct rq *this_rq)
interval = msecs_to_jiffies(sd->balance_interval); interval = msecs_to_jiffies(sd->balance_interval);
if (time_after(next_balance, sd->last_balance + interval)) if (time_after(next_balance, sd->last_balance + interval))
next_balance = sd->last_balance + interval; next_balance = sd->last_balance + interval;
if (pulled_task)
/*
* Stop searching for tasks to pull if there are
* now runnable tasks on this rq.
*/
if (pulled_task || this_rq->nr_running > 0)
break; break;
} }
rcu_read_unlock(); rcu_read_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment