aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched_fair.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r--kernel/sched_fair.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 3f7ec9e27ee1..7f00772e57c9 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/latencytop.h> 23#include <linux/latencytop.h>
24#include <linux/sched.h> 24#include <linux/sched.h>
25#include <linux/cpumask.h>
25 26
26/* 27/*
27 * Targeted preemption latency for CPU-bound tasks: 28 * Targeted preemption latency for CPU-bound tasks:
@@ -3061,7 +3062,7 @@ static inline void calculate_imbalance(struct sd_lb_stats *sds, int this_cpu,
3061 3062
3062 /* 3063 /*
3063 * if *imbalance is less than the average load per runnable task 3064 * if *imbalance is less than the average load per runnable task
3064 * there is no gaurantee that any tasks will be moved so we'll have 3065 * there is no guarantee that any tasks will be moved so we'll have
3065 * a think about bumping its value to force at least one task to be 3066 * a think about bumping its value to force at least one task to be
3066 * moved 3067 * moved
3067 */ 3068 */
@@ -3819,6 +3820,17 @@ void select_nohz_load_balancer(int stop_tick)
3819 3820
3820static DEFINE_SPINLOCK(balancing); 3821static DEFINE_SPINLOCK(balancing);
3821 3822
3823static unsigned long __read_mostly max_load_balance_interval = HZ/10;
3824
3825/*
3826 * Scale the max load_balance interval with the number of CPUs in the system.
3827 * This trades load-balance latency on larger machines for less cross talk.
3828 */
3829static void update_max_interval(void)
3830{
3831 max_load_balance_interval = HZ*num_online_cpus()/10;
3832}
3833
3822/* 3834/*
3823 * It checks each scheduling domain to see if it is due to be balanced, 3835 * It checks each scheduling domain to see if it is due to be balanced,
3824 * and initiates a balancing operation if so. 3836 * and initiates a balancing operation if so.
@@ -3848,10 +3860,7 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle)
3848 3860
3849 /* scale ms to jiffies */ 3861 /* scale ms to jiffies */
3850 interval = msecs_to_jiffies(interval); 3862 interval = msecs_to_jiffies(interval);
3851 if (unlikely(!interval)) 3863 interval = clamp(interval, 1UL, max_load_balance_interval);
3852 interval = 1;
3853 if (interval > HZ*NR_CPUS/10)
3854 interval = HZ*NR_CPUS/10;
3855 3864
3856 need_serialize = sd->flags & SD_SERIALIZE; 3865 need_serialize = sd->flags & SD_SERIALIZE;
3857 3866