All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] sched/fair: fix update the nohz.next_balance even if we haven't done any load balance
@ 2015-03-27  7:52 Wanpeng Li
  2015-03-27 11:28 ` Srikar Dronamraju
  0 siblings, 1 reply; 2+ messages in thread
From: Wanpeng Li @ 2015-03-27  7:52 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>
Reviewed-by: Jason Low <jason.low2@hp.com>
Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-27  7:52 [PATCH v2] sched/fair: fix update the nohz.next_balance even if we haven't done any load balance Wanpeng Li
2015-03-27 11:28 ` Srikar Dronamraju

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.