From 45b94f92cfad4c17028331926f323103deaf4dfb Mon Sep 17 00:00:00 2001 From: franciscofranco Date: Mon, 5 Sep 2016 20:35:26 +0700 Subject: [PATCH] Optimized Task-Search for upto 6% increase in Performance --- kernel/sched/fair.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 41d0cbda6..ad5089926 100755 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6386,7 +6386,6 @@ void idle_balance(int this_cpu, struct rq *this_rq) continue; if (sd->flags & SD_BALANCE_NEWIDLE) { - /* If we've pulled tasks over stop searching: */ pulled_task = load_balance(this_cpu, this_rq, sd, CPU_NEWLY_IDLE, &balance); } @@ -6394,7 +6393,11 @@ void idle_balance(int this_cpu, struct rq *this_rq) interval = msecs_to_jiffies(sd->balance_interval); if (time_after(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) { this_rq->idle_stamp = 0; break; }