Skip to content

Commit

Permalink
Optimized Task-Search for upto 6% increase in Performance
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscofranco authored and NotNoelChannel committed Nov 29, 2023
1 parent 51ba0cd commit 45b94f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -6386,15 +6386,18 @@ 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);
}

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;
}
Expand Down

0 comments on commit 45b94f9

Please sign in to comment.