Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3247529pxu; Tue, 8 Dec 2020 07:16:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYoAaOwIYlT9kBeXSLI5mvLq2YJkrvFYAk4szYOzXmuxUcO5HvXHcF6fUCKm7nJFpI/6IT X-Received: by 2002:a17:906:e81:: with SMTP id p1mr24059447ejf.494.1607440585085; Tue, 08 Dec 2020 07:16:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607440585; cv=none; d=google.com; s=arc-20160816; b=t7b8w9P270wv5ocUT1ZD4QtM6op+K17jQGltpklr+Zy/efXvEKP4b7Bn62Ex6sT/mN 0TS2kEbteLDsMzRbzNm9f8pOhPXlZQ1SZacmA7Um2X37sksNqUdIwdxFx9ieaZ5UmJUd Z+txMyK5duYD1cUC+3bNC2Uo4Xf7hPbrAOkX5wBYxHh3DBafqTMaACaETvhgLZ8B/rCY SpuauSKxztbqdTWTJDA7JUKvn2C84oQFvpKKuyoGbI2ypz9XndzrCgZ+8HwzJQtWRj6G NfM1KO9IRTSTTl35+po7U9lW1UySjGBtlfNto54bgHUwBnjMeu30J2rr8QHlYbsm3X56 LOuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=O/Wn81TLMSD8dTenOxIdRK/VUO9S73tCwIjq7m704tc=; b=eLAak+vjujMv+OQAWvIiTZ0zM/7Wax/YmD+E6elgPE+9fldmZ4rsBCb1Cos5nqYXU5 iujwzhWH+aQ2cvbrrGUDKnzlDyEvlYrPU0GOm76En18AGneqZPx661LgzmMOVELI2771 K3hVtmSpoI2ck+7m+sewBWh8JB2W3bJKWPQWVG8Jxxb6LoMAU624FCSNdksTHFvbIBCs KCSAtgH9cC5bz69HAH2jolcJGxf30OIJnvtrr+jO4KxsCY9SsiPJe3jfQBwIX+xTLA8V 8PDv2qHstKniRiwasrzaWoeKbIiPZNmHeIElMoCcrzBNzhKddO8wIfPypcfAt3YDP4rg glxw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v2si10733614edw.41.2020.12.08.07.16.00; Tue, 08 Dec 2020 07:16:25 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729572AbgLHPNV (ORCPT + 99 others); Tue, 8 Dec 2020 10:13:21 -0500 Received: from outbound-smtp27.blacknight.com ([81.17.249.195]:47794 "EHLO outbound-smtp27.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727925AbgLHPNU (ORCPT ); Tue, 8 Dec 2020 10:13:20 -0500 Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp27.blacknight.com (Postfix) with ESMTPS id A7966CAC7A for ; Tue, 8 Dec 2020 15:12:28 +0000 (GMT) Received: (qmail 7102 invoked from network); 8 Dec 2020 15:12:28 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 8 Dec 2020 15:12:28 -0000 Date: Tue, 8 Dec 2020 15:12:26 +0000 From: Mel Gorman To: Vincent Guittot Cc: Dietmar Eggemann , LKML , Aubrey Li , Barry Song , Ingo Molnar , Peter Ziljstra , Juri Lelli , Valentin Schneider , Linux-ARM Subject: Re: [PATCH 1/4] sched/fair: Remove SIS_AVG_CPU Message-ID: <20201208151226.GK3371@techsingularity.net> References: <20201207091516.24683-1-mgorman@techsingularity.net> <20201207091516.24683-2-mgorman@techsingularity.net> <25a8c4bd-792b-2851-b10a-c4375eb83dfe@arm.com> <20201208105900.GG3371@techsingularity.net> <20201208133650.GI3371@techsingularity.net> <20201208135358.GJ3371@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 08, 2020 at 03:47:40PM +0100, Vincent Guittot wrote: > > I considered it but made the choice to exclude the cost of cpumask_and() > > from the avg_scan_cost instead. It's minor but when doing the original > > At the cost of a less readable code > Slightly less readable, yes. > > prototype, I didn't think it was appropriate to count the cpumask > > clearing as part of the scan cost as it's not directly related. > > hmm... I think it is because the number of loop is directly related to > the allowed cpus > While that is true, the cost of initialising the map is constant and what is most important is tracking the scan cost which is variable. Without SIS_AVG_CPU, the cpumask init can go before SIS_PROP without any penalty so is this version preferable? --8<-- sched/fair: Move avg_scan_cost calculations under SIS_PROP As noted by Vincent Guittot, avg_scan_costs are calculated for SIS_PROP even if SIS_PROP is disabled. Move the time calculations under a SIS_PROP check and while we are at it, exclude the cost of initialising the CPU mask from the average scan cost. Signed-off-by: Mel Gorman --- kernel/sched/fair.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ac7b34e7372b..5c41875aec23 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6153,6 +6153,8 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t if (!this_sd) return -1; + cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr); + if (sched_feat(SIS_PROP)) { u64 avg_cost, avg_idle, span_avg; @@ -6168,11 +6170,9 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t nr = div_u64(span_avg, avg_cost); else nr = 4; - } - - time = cpu_clock(this); - cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr); + time = cpu_clock(this); + } for_each_cpu_wrap(cpu, cpus, target) { if (!--nr) @@ -6181,8 +6181,10 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t break; } - time = cpu_clock(this) - time; - update_avg(&this_sd->avg_scan_cost, time); + if (sched_feat(SIS_PROP)) { + time = cpu_clock(this) - time; + update_avg(&this_sd->avg_scan_cost, time); + } return cpu; }