public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: fix update the nohz.next_balance even if we haven't done any load balance
@ 2015-03-27  7:25 Wanpeng Li
  2015-03-27  7:58 ` Jason Low
  2015-03-27 16:57 ` Preeti U Murthy
  0 siblings, 2 replies; 4+ messages in thread
From: Wanpeng Li @ 2015-03-27  7:25 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Srikar Dronamraju, Jason Low, Preeti U Murthy, linux-kernel,
	Wanpeng Li

As Srikar pointed out (https://lkml.org/lkml/2015/3/27/26):

| With the current code when the ilb cpus are not free: 
| - We would be updating the nohz.next_balance even through we havent done
|   any load balance.
| - We might iterate thro the nohz.idle_cpus_mask()s to find balance_cpus.

This patch fix it by adding need_resched check with the idle check, and 
keep the need_resched check in for loop to catch ilb get busy. 

Suggested-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0576ce0..1d3e17f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7639,7 +7639,8 @@ static void nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle)
 	int balance_cpu;
 
 	if (idle != CPU_IDLE ||
-	    !test_bit(NOHZ_BALANCE_KICK, nohz_flags(this_cpu)))
+	    !test_bit(NOHZ_BALANCE_KICK, nohz_flags(this_cpu)) ||
+		need_resched())
 		goto end;
 
 	for_each_cpu(balance_cpu, nohz.idle_cpus_mask) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-27 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-27  7:25 [PATCH] sched/fair: fix update the nohz.next_balance even if we haven't done any load balance Wanpeng Li
2015-03-27  7:58 ` Jason Low
2015-03-27  7:45   ` Wanpeng Li
2015-03-27 16:57 ` Preeti U Murthy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox