Skip to content

Commit

Permalink
sched: Fix rebalance interval calculation
Browse files Browse the repository at this point in the history
The interval for checking scheduling domains if they are due to be
balanced currently depends on boot state NR_CPUS, which may not
accurately reflect the number of online CPUs at the time of check.

Thus replace NR_CPUS with num_online_cpus().

 (ed: Should only affect those who set NR_CPUS really high, such as 4096
      or so :-)

Signed-off-by: Sisir Koppaka <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
ahoy196 authored and Ingo Molnar committed Mar 31, 2011
1 parent e2495b5 commit 3436ae1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <linux/latencytop.h>
#include <linux/sched.h>
#include <linux/cpumask.h>

/*
* Targeted preemption latency for CPU-bound tasks:
Expand Down Expand Up @@ -3850,8 +3851,8 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle)
interval = msecs_to_jiffies(interval);
if (unlikely(!interval))
interval = 1;
if (interval > HZ*NR_CPUS/10)
interval = HZ*NR_CPUS/10;
if (interval > HZ*num_online_cpus()/10)
interval = HZ*num_online_cpus()/10;

need_serialize = sd->flags & SD_SERIALIZE;

Expand Down

0 comments on commit 3436ae1

Please sign in to comment.