From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753524AbbC0IDi (ORCPT ); Fri, 27 Mar 2015 04:03:38 -0400 Received: from mga01.intel.com ([192.55.52.88]:5790 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753415AbbC0ID2 (ORCPT ); Fri, 27 Mar 2015 04:03:28 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,477,1422950400"; d="scan'208";a="686450080" Date: Fri, 27 Mar 2015 15:45:09 +0800 From: Wanpeng Li To: Jason Low Cc: Ingo Molnar , Peter Zijlstra , Srikar Dronamraju , Preeti U Murthy , 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 Message-ID: <20150327074509.GA6953@kernel> Reply-To: Wanpeng Li References: <1427441100-6892-1-git-send-email-wanpeng.li@linux.intel.com> <1427443102.2788.44.camel@j-VirtualBox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1427443102.2788.44.camel@j-VirtualBox> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 27, 2015 at 12:58:22AM -0700, Jason Low wrote: >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 >> Signed-off-by: Wanpeng Li >> --- >> 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. Will do. > >Besides that: > >Reviewed-by: Jason Low Thanks, ;) Regards, Wanpeng Li