From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C21AC433E0 for ; Thu, 4 Feb 2021 16:24:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFCCB64F10 for ; Thu, 4 Feb 2021 16:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237110AbhBDQYV (ORCPT ); Thu, 4 Feb 2021 11:24:21 -0500 Received: from foss.arm.com ([217.140.110.172]:59908 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237104AbhBDPGn (ORCPT ); Thu, 4 Feb 2021 10:06:43 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BA03411D4; Thu, 4 Feb 2021 07:05:40 -0800 (PST) Received: from e107158-lin (e107158-lin.cambridge.arm.com [10.1.194.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 684DB3F718; Thu, 4 Feb 2021 07:05:39 -0800 (PST) Date: Thu, 4 Feb 2021 15:05:36 +0000 From: Qais Yousef To: Valentin Schneider Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Vincent Guittot , Dietmar Eggemann , Morten Rasmussen , Quentin Perret , Pavan Kondeti , Rik van Riel Subject: Re: [PATCH 1/8] sched/fair: Clean up active balance nr_balance_failed trickery Message-ID: <20210204150536.2d26y7zrp7vhmn53@e107158-lin> References: <20210128183141.28097-1-valentin.schneider@arm.com> <20210128183141.28097-2-valentin.schneider@arm.com> <20210203151429.rnbdgt7wyoaz2vui@e107158-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/21 18:42, Valentin Schneider wrote: > >> @@ -9805,9 +9810,6 @@ static int load_balance(int this_cpu, struct rq *this_rq, > >> active_load_balance_cpu_stop, busiest, > >> &busiest->active_balance_work); > >> } > >> - > >> - /* We've kicked active balancing, force task migration. */ > >> - sd->nr_balance_failed = sd->cache_nice_tries+1; > > > > This has an impact on future calls to need_active_balance() too, no? We enter > > this path because need_active_balance() returned true; one of the conditions it > > checks for is > > > > return unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2); > > > > So since we used to reset nr_balanced_failed to cache_nice_tries+1, the above > > condition would be false in the next call or two IIUC. But since we remove > > that, we could end up here again soon. > > > > Was this intentional? > > > > Partially, I'd say :-) > > If you look at active_load_balance_cpu_stop(), it does > > sd->nr_balance_failed = 0; > > when it successfully pulls a task. So we get a reset of the failed counter > on pull, which I've preserved. As for interactions with later > need_active_balance(), the commit that introduced the current counter write > (which is over 15 years old!): > > 3950745131e2 ("[PATCH] sched: fix SMT scheduling problems") > > only states the task_hot() issue; thus I'm doubtful whether said > interaction was intentional. The '+1' was added in that comment. 'Original' code was just resetting the nr_balance_failed cache_nice_tries, so that we don't do another one too soon I think. With this change, no active balance is allowed until later. Which makes sense. I can't see why we would have allowed another kick sooner tbh. But as you say, this is ancient piece of logic. I agree I can't see a reason to worry about this (potential) change of behavior. Thanks -- Qais Yousef