Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4684472pxu; Thu, 10 Dec 2020 02:59:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8g9SRRmR9bM2b2upjH0FUb6U51ytSSsoY3jCkIIf2h3xepohSZYQrj9U0OK8mM8kt9ARE X-Received: by 2002:a05:6402:697:: with SMTP id f23mr6316707edy.318.1607597979639; Thu, 10 Dec 2020 02:59:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607597979; cv=none; d=google.com; s=arc-20160816; b=MgbqvFFPWGyg3pCak63p8yhih0YLvDi6XEyYeXulBVVh+KOwgDZQGV2jl/sbKv9HoX X1M9eZVhBr3LaFnj05CWe3R2A47SIOFiftg9msM5QVBNSEpChJ4pyOH0NND+fpL0ubHh 2s9sv/ldal4dj2Uqt1tTYw//s74hnO1XmAyXM3J+0Bh+Ya2XJeS4qw4kLsOmMHgm78Y0 OVPNaTAk6y2/I06XJR866u9s9PZBhHFeGanrybw0vJtiOCjofAk4lYCEM2iI5zWSISqQ M1DDTl3GZP5JnCdUd/Pfs6KtR6Rc08gJyWKKRh5anuJDrUnF4l1bpHKu/iDuIY7LgOlx vLsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=uuTet0rHjT9FGu5cvBCQ4opdjaDy8wciCzFek7yoMuE=; b=krVuyIaef3bFgDPLqP0MYO4qH+Mj85My0XhuqYgb8sVpDo/jVQJVLp4sBS5Xwui5bO 37DGnyR/IPY/H1X3MR2eKCYbhq54wIOd0M/jTDxaTYIoPOlJcfQafVBfSPo+RVus2ZOp WD28iaeq2fP2g7s6MiHvJCwrQ0kCA+bV8uhQOYbDOFXt8N7erp9IXYYhracVjVBDgOUM Ip7ghiIhFStA3RmsY8xUnFz0puhunMsQfNlkTSpJonuZe55IGQ4Iw0vF17xpw5KbcthK 9Op8j0jqnqv7Wuj7EJ8VKr6OBgRhp/82jxRROF7z1BKmuFvMrrTlD2pRkjM5UJw4GGnk SAKg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si2252303ejb.322.2020.12.10.02.59.03; Thu, 10 Dec 2020 02:59:39 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727262AbgLJFTy (ORCPT + 99 others); Thu, 10 Dec 2020 00:19:54 -0500 Received: from mga17.intel.com ([192.55.52.151]:55322 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726350AbgLJFTy (ORCPT ); Thu, 10 Dec 2020 00:19:54 -0500 IronPort-SDR: rxy2SVqDq4P3mQtF/ScCN/j0mjoDcV/Gfn1Zg/Bjn1V/g6QSYtaPcVc9mebfJZGHn9EQ76jcAG 3lm6B/tIX1zQ== X-IronPort-AV: E=McAfee;i="6000,8403,9830"; a="154005495" X-IronPort-AV: E=Sophos;i="5.78,407,1599548400"; d="scan'208";a="154005495" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2020 21:18:08 -0800 IronPort-SDR: vYiZw4aafPvsqj01p2l/4jFqU3PZ7yefYFIVT1kHVMg21klL1Sp8S2BnPTtUrFf6MMeb1Ymj7F Y2kPKlMvxhPQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,407,1599548400"; d="scan'208";a="368633393" Received: from cli6-desk1.ccr.corp.intel.com (HELO [10.239.161.125]) ([10.239.161.125]) by fmsmga004.fm.intel.com with ESMTP; 09 Dec 2020 21:18:06 -0800 Subject: Re: [PATCH 2/4] sched/fair: Move avg_scan_cost calculations under SIS_PROP To: Mel Gorman , Peter Ziljstra , Ingo Molnar , LKML Cc: Barry Song , Juri Lelli , Vincent Guittot , Valentin Schneider , Linux-ARM References: <20201208153501.1467-1-mgorman@techsingularity.net> <20201208153501.1467-3-mgorman@techsingularity.net> From: "Li, Aubrey" Message-ID: <1963d0ca-054c-19f9-94e0-d019a2e8e259@linux.intel.com> Date: Thu, 10 Dec 2020 13:18:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20201208153501.1467-3-mgorman@techsingularity.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/12/8 23:34, Mel Gorman wrote: > 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) > return -1; I thought about this again and here seems not to be consistent: - even if nr reduces to 0, shouldn't avg_scan_cost be updated as well before return -1? - if avg_scan_cost is not updated because nr is throttled, the first time = cpu_clock(this); can be optimized. As nr is calculated and we already know which of the weight of cpumask and nr is greater. Thanks, -Aubrey