From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753098AbdKJOxV (ORCPT ); Fri, 10 Nov 2017 09:53:21 -0500 Received: from foss.arm.com ([217.140.101.70]:60232 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752675AbdKJOxU (ORCPT ); Fri, 10 Nov 2017 09:53:20 -0500 References: <20171024122556.15872-1-brendan.jackman@arm.com> <20171024122556.15872-2-brendan.jackman@arm.com> User-agent: mu4e 0.9.18; emacs 25.2.2 From: Brendan Jackman To: Todd Kjos Cc: Vincent Guittot , Dietmar Eggemann , Ingo Molnar , Peter Zijlstra , LKML , Ingo Molnar , Morten Rasmussen Subject: Re: [PATCH 1/2] sched: force update of blocked load of idle cpus In-reply-to: Date: Fri, 10 Nov 2017 14:53:12 +0000 Message-ID: <87k1yydw2v.fsf@arm.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Todd, On Thu, Nov 09 2017 at 19:56, Todd Kjos wrote: >> @@ -8683,6 +8692,10 @@ static void nohz_balancer_kick(void) >> >> if (test_and_set_bit(NOHZ_BALANCE_KICK, nohz_flags(ilb_cpu))) >> return; >> + >> + if (only_update) >> + set_bit(NOHZ_STATS_KICK, nohz_flags(ilb_cpu)); > > Should there be an "else clear_bit(NOHZ_STATS_KICK, nohz_flags(ilb_cpu));" ? > > Seems like any time this is called as !only_update, we should stop > inhibiting rebalance. In fact, we should perhaps go a little further > so that an only_update never inhibits rebalance from a concurrent > !only_update. Yes, I think you are essentially right. To make sure I understand you: I guess you are saying that where two CPUs are concurrently in nohz_balancer_kick, one with only_update=1 and one with only_update=0, the former should not prevent the latter from triggering a full load balance. (I'm assuming they both get the same value for ilb_cpu). The exact solution you described won't work: only one of those CPUs can get to this line of code, because of the test_and_set_bit above. So I think we need something like: if (test_and_set_bit(NOHZ_BALANCE_KICK, nohz_flags(ilb_cpu))) { if (!only_update) { /* * There's a pending stats kick or an ongoing * nohz_idle balance that's just for stats. * Convert it to a proper nohz balance. */ clear_bit(NOHZ_STATS_KICK, nohz_flags(ilb_cpu)); } return; } if (only_update) set_bit(NOHZ_STATS_KICK, nohz_flags(ilb_cpu)); There's still scope for some lost rebalance_domains calls, but as Vincent pointed out in a recent chat, because the rq->next_balance fields won't be changed for the CPUs they get missed out, those will only be delayed until the next scheduler_tick. I'm on holiday ATM, I'll get to testing that when I get back. Thanks for the review, Brendan