>>From 7511dd0a73aaf2ca4bcd829f991dcd2c839c5417 Mon Sep 17 00:00:00 2001 From: Alex Shi Date: Fri, 24 Jan 2014 15:17:02 +0800 Subject: [PATCH] sched: only do load balance on tick_do_timer_cpu that is a central balance. Signed-off-by: Alex Shi --- kernel/sched/core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7368964..1be85a7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2425,6 +2425,7 @@ unsigned long long task_sched_runtime(struct task_struct *p) return ns; } +extern int tick_do_timer_cpu __read_mostly; /* * This function gets called by the timer code, with HZ frequency. * We call it with interrupts disabled. @@ -2446,8 +2447,11 @@ void scheduler_tick(void) perf_event_task_tick(); #ifdef CONFIG_SMP - rq->idle_balance = idle_cpu(cpu); - trigger_load_balance(rq); + /* only do load balance on tick_do_timer_cpu */ + if (cpu == tick_do_timer_cpu) { + rq->idle_balance = idle_cpu(cpu); + trigger_load_balance(rq); + } #endif rq_last_tick_reset(rq); } -- 1.8.5.2