Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1254450pxb; Thu, 4 Feb 2021 08:28:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxX4yMXFrFhHppHEUxiczykGnK9/A8q1F1frdKYmaRv2tx6FTpRPhNoeWEuYp4ytuq5Wg45 X-Received: by 2002:a17:906:3e42:: with SMTP id t2mr5877214eji.439.1612456133452; Thu, 04 Feb 2021 08:28:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612456133; cv=none; d=google.com; s=arc-20160816; b=sOqxoOKe6qeCJc8jp99KOCqxKOr6jCAzq1EZEYI9fv05Iz0kmOVsBoe8Z6xHgiS0// cbb44BonCdeZ2mqxuZtI3a77NQbEcpr2xC7z6Ha+mtq+Ch07V1DcCiNm1E657hhjrMf4 rZfSU1VTqvfVvdOl8hWuiW0gsQ0PloQuw41jQlK88QupqkFykRafZKfot8mZsBs1XFcx 4YqeA3b2g8DhE20XBrxmVuWH056ta5sm2mr6js/d7GyeMa3m3PbFjTV6PRE3CcarO+8B KqvedSmfoFNC/rqz8PhLey5hz4yj6vmK5H23vapqPfVH8Gy5DbminwUYM1Lj/HiB8/M4 +WBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=bhnfndK7nh9aB/rmej0OCeR7MZOXLejWKGlib93Nw8o=; b=Ynt8sU9BV0D1a/ualAW0O77e4dZNAlVZlrilOIcG1wJiIEv79jg05zuHlBsFabBKcz t0XHGvdWc2PDoprw2pcRfTiCqcI8lN+emXDEew9B5yyi+QufP/vk4DIGnMbcqpShjy26 n4J4pshy9X7b4DZMrml2d8D3OL5zVXSRagWzve0Vhz8qbIfKKGNp6Y4xsAQmQ/wrvRsC iLwWIjt5sBVUYjhXyNIpBSP7trr1XeZ7MEfQEwXEIVGrVigw0iZ58ybLMsAE9qgrld49 b5H/zYb1E9mDdkAc4m8m+eb9UtaFdKeHb3HoLPczf0D5DjbNuwLIDSL3JgxH6I3cmdZy pwqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dj25si3343008edb.580.2021.02.04.08.28.28; Thu, 04 Feb 2021 08:28:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237109AbhBDQYP (ORCPT + 99 others); Thu, 4 Feb 2021 11:24:15 -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