Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3452400pxu; Tue, 8 Dec 2020 12:25:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlm4jqNi8jFiDNcaKiRIit1YbgurU2z6bQtWuDg3Br45PxLzTpAu295wX3zdJzpFHj3svj X-Received: by 2002:a17:906:c04d:: with SMTP id bm13mr24288905ejb.519.1607459132593; Tue, 08 Dec 2020 12:25:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607459132; cv=none; d=google.com; s=arc-20160816; b=qq04M84Hr9/BnaAwnwSBBufsK3IeI9fGIfiQT1scmBKCsj3GrxDSdObX5hDN/MpAuS Tppm54Y/qhJXC/PESiLHOjeCrYIe5avdtDkOgpbztDkVa/oQscCd9bOfXTdk3N40U4AI 2QuaO0PPhmXIJmr4f9hRWpZZVFhzW+aYT/j9lPQemO7LPFeMxzO/LnBi26yp6L+ECVyB gHCPGbXKO6nKgWXICz22EE3/S8ILvB8Ce69zGiS+r36EcfH7ZOceFZV1ToVb5YX4/MB2 kLvzzbI0y60BAxLIvg7PfBJp3/ER1J08ue9n3NSOssDQ+cQS/hzOjOtqvETzRPxVKqWD YmOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Me1Hf/Cdi3kKip0U1Ne9HhgL9kDjgNH3pBgdMTwceuo=; b=016tUR/efMIRVxkPcDNnPaW+8tH8/gGbJCl12GRxsOd0FUVXylRZOXqKFMd8W9uuLG iXe78Sc+hQ979sY3hpexE+Y7Zybb8OHtV19Qz0+P+vC0juHp82BOcYeLOJ3EHfNH8iCb ZcMb/VT4HPd82RXKjzqjQ2kMiHYbUqzETaJteHbLOZy0TgTwv8cuhz6NhCaNB2Ju4in6 FVX2qMUfxDT4VOZzTN33EQscFAJnl5QibKsN/TDZnZBT3xyKN4XX5wHljNqtTMR0C86Y 9Ers2wz23dTvJCX/FAxpzOlO9WAvigFajjCY2/sJUomtOn+lGeiebFGgqsUUGuS7F9DQ jqFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yVcnWg8c; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j17si8815212ejk.231.2020.12.08.12.25.08; Tue, 08 Dec 2020 12:25:32 -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; dkim=pass header.i=@linaro.org header.s=google header.b=yVcnWg8c; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729833AbgLHPUf (ORCPT + 99 others); Tue, 8 Dec 2020 10:20:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729379AbgLHPUe (ORCPT ); Tue, 8 Dec 2020 10:20:34 -0500 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 501EEC061793 for ; Tue, 8 Dec 2020 07:19:54 -0800 (PST) Received: by mail-lj1-x241.google.com with SMTP id f24so19980970ljk.13 for ; Tue, 08 Dec 2020 07:19:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Me1Hf/Cdi3kKip0U1Ne9HhgL9kDjgNH3pBgdMTwceuo=; b=yVcnWg8cYTjBfJFA8cYSxoLVrLkBgv4MV7PKXmUjaFNZBGpw8Gz+bhjqNbTxg3Gw49 rc33XM18c1tE9/APiOrPNDLzj94JJBdEcyL1bqE5DNBWClhLS52CWEt19nOtqQyoecpx mCLKx5mhumj6Iwae+QTPOis/f85Fkkl5JyUm+PX1UQi0zSQkoIMcOcDh1eXZfMlms07S qvRHHDioV4/6JaX8ro1P/EV2TY6sqHsQyzSgt5at+T9ISl+DZ1k4alqjO1ZIMBrv2t7M VtJN9y48+T3/cudY+EqVttyrnUtDbldPc6gvGO65jKuyRQg9mDXj7R/Oy7e9iOf6X4tj nBCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Me1Hf/Cdi3kKip0U1Ne9HhgL9kDjgNH3pBgdMTwceuo=; b=UKzAOD4e4teKHhKT3+AnxleZcUFazehIfRKYcH7/E35thmu+7U2CAhv85t+OBwjuXl CXBy1+NkNv6HZDBSRzbs5XNnWh1KluGQ31RXKQSHOi7AMnL9AUhYMUoBzJgV96xahTvn VYtdni1Kyi0HYhOJIp2I6Nzy0VFXlPaXURfWnE57iADwmDmxNPZGIk3/PP0DkSv0Aq8+ ztHnEA2zVslsJEM1RtB/Py4jQiRAtU63hnetWqqo6+70o+0jOgyJVSMuVVoXMjALXYSn yV/LVoEmSpBpMh7/goBeHS/czBwr8T33Fd+/oqBT4GNcpwgnMfD7tfyrC9Mgk+rZzV7T /aKw== X-Gm-Message-State: AOAM533N8aOfLEJF1dWYmLFDoLNbieKjvVVKRKNu2hUWxhZ/1/ug5nl2 jxpNffBVew4JMLks1iHyE6JkuOSkFybDG0hgmIbeqA== X-Received: by 2002:a2e:9913:: with SMTP id v19mr3955192lji.209.1607440791659; Tue, 08 Dec 2020 07:19:51 -0800 (PST) MIME-Version: 1.0 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> <20201208151226.GK3371@techsingularity.net> In-Reply-To: <20201208151226.GK3371@techsingularity.net> From: Vincent Guittot Date: Tue, 8 Dec 2020 16:19:40 +0100 Message-ID: Subject: Re: [PATCH 1/4] sched/fair: Remove SIS_AVG_CPU To: Mel Gorman Cc: Dietmar Eggemann , LKML , Aubrey Li , Barry Song , Ingo Molnar , Peter Ziljstra , Juri Lelli , Valentin Schneider , Linux-ARM Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Dec 2020 at 16:12, Mel Gorman wrote: > > 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? yes looks good to me > > --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; > }