lkml.org 
[lkml]   [2015]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] sched/fair: fix update the nohz.next_balance even if we haven't done any load balance
Date
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


\
 
 \ /
  Last update: 2015-03-27 09:01    [W:0.369 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site