public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Low <jason.low2@hp.com>
To: Wanpeng Li <wanpeng.li@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	Preeti U Murthy <preeti@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org, jason.low2@hp.com
Subject: Re: [PATCH] sched/fair: fix update the nohz.next_balance even if we haven't done any load balance
Date: Fri, 27 Mar 2015 00:58:22 -0700	[thread overview]
Message-ID: <1427443102.2788.44.camel@j-VirtualBox> (raw)
In-Reply-To: <1427441100-6892-1-git-send-email-wanpeng.li@linux.intel.com>

On Fri, 2015-03-27 at 15:25 +0800, Wanpeng Li wrote:
> 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;

How about having:

	if (idle != CPU_IDLE || need_resched() ||
	    !test_bit(NOHZ_BALANCE_KICK, nohz_flags(this_cpu)))

which wouldn't require adding a new line.

Besides that:

Reviewed-by: Jason Low <jason.low2@hp.com>


  reply	other threads:[~2015-03-27  7:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-03-27  7:45   ` Wanpeng Li
2015-03-27 16:57 ` Preeti U Murthy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427443102.2788.44.camel@j-VirtualBox \
    --to=jason.low2@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=preeti@linux.vnet.ibm.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=wanpeng.li@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox