From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754433AbbC0Q6K (ORCPT ); Fri, 27 Mar 2015 12:58:10 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:52270 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754388AbbC0Q5x (ORCPT ); Fri, 27 Mar 2015 12:57:53 -0400 Message-ID: <55158C01.3040106@linux.vnet.ibm.com> Date: Fri, 27 Mar 2015 22:27:37 +0530 From: Preeti U Murthy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Wanpeng Li , Ingo Molnar , Peter Zijlstra CC: Srikar Dronamraju , Jason Low , linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched/fair: fix update the nohz.next_balance even if we haven't done any load balance References: <1427441100-6892-1-git-send-email-wanpeng.li@linux.intel.com> In-Reply-To: <1427441100-6892-1-git-send-email-wanpeng.li@linux.intel.com> Content-Type: text/plain; charset=ISO-8859-6 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15032716-0005-0000-0000-000009B8A841 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Wanpeng, On 03/27/2015 12:55 PM, 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; > > for_each_cpu(balance_cpu, nohz.idle_cpus_mask) { If need_resched() becomes true between this point and the test within the 'for' loop, you will end up with the original problem again. So the patch does not completely solve the said problem. Besides, are we really going to gain measurable performance with this patch? Regards Preeti U Murthy >