Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2716633pxb; Tue, 19 Jan 2021 04:30:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdYZ+Skhv7lyMKa/bwoa8gzUdjrDiJuUaT7s5B4z9iu6RFTwCQr52riIxwhIPfr9x9PN7d X-Received: by 2002:a05:6402:5206:: with SMTP id s6mr3139135edd.92.1611059407697; Tue, 19 Jan 2021 04:30:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611059407; cv=none; d=google.com; s=arc-20160816; b=xxNb2eyFBPA9wy8umKk2/8ckDoJQq6yKXRPA8JdJ+N3P/b7pnn2VgC7/gI7b/afc99 nY6lOW5VArJWeoJv1GS1B2H2/raWVzmcjtFiLkUXbbHFY2kOFR6A1Z8kXtC5voB1u4nM vFzzMjBjSOffGmfJwzy/E1jSoISfAbylbas+1t0PNfniwrQSL1re3xJhGf0Mw34Qenj0 fJTsUorWBpKhh7C+rREnaXKPqxPfDOUCr/RK0wfu+ksvN+9XwIiHkcrw3ax4RlTwp1bv xktoYrskDatYlx0ODWouTqTD3PrlcLN2soPT2VbZfFJYHDBlC+Wp0Thfs73p0rQlb2XV SlTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gDr9FG48Yoe9BhPwSRMF9O7EeOj3oENArzPnwnEQb54=; b=EPrwdrK9X3Kr0FDmJcwdVNe4k5XRmIEH5lkQi988EknZr72fm5vQwK0nma8rBIDf/0 orpUKp6znYqWzpapXIMeAW8+2rmV6ug+oKQ2kHrscTR+IlFqOGv+kflrTt6nv4DaWIqn gLBkD8t01cVRrzyi9kQamzMvlUSvuxhaAxgA8amxhja3aIu6WviYgqYhnJ69fVmeRFJb Ht2sgyjmKQ4Xhfa3+XE8ZRiRZue3Qv2fo7V3d82Kv/0+mFJblnns86lVMg10hPvLADQ5 9TizkSXi356vvblEmAg6icdorY7oATtMZ4y6IlL1BgWUGkcc/5Quz+/4AE2RG5vaCe9G z8Ww== 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 by9si3330005ejb.306.2021.01.19.04.29.38; Tue, 19 Jan 2021 04:30:07 -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 S2391506AbhASLfh (ORCPT + 99 others); Tue, 19 Jan 2021 06:35:37 -0500 Received: from outbound-smtp38.blacknight.com ([46.22.139.221]:40323 "EHLO outbound-smtp38.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390431AbhASLXK (ORCPT ); Tue, 19 Jan 2021 06:23:10 -0500 Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp38.blacknight.com (Postfix) with ESMTPS id 54E192E1D for ; Tue, 19 Jan 2021 11:22:12 +0000 (GMT) Received: (qmail 4644 invoked from network); 19 Jan 2021 11:22:12 -0000 Received: from unknown (HELO stampy.112glenside.lan) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPA; 19 Jan 2021 11:22:12 -0000 From: Mel Gorman To: Peter Zijlstra , Ingo Molnar Cc: Vincent Guittot , Li Aubrey , Qais Yousef , LKML , Mel Gorman Subject: [PATCH 2/5] sched/fair: Move avg_scan_cost calculations under SIS_PROP Date: Tue, 19 Jan 2021 11:22:08 +0000 Message-Id: <20210119112211.3196-3-mgorman@techsingularity.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210119112211.3196-1-mgorman@techsingularity.net> References: <20210119112211.3196-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 9f5682aeda2e..c8d8e185cf3b 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; } -- 2.26.2