Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp825762imm; Tue, 5 Jun 2018 05:12:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLFoTiZO7vgbc1+N8eyRsY3EXHvf4w9F+4afkbk6V41LpvruND7e4K/ZQZJ/kvfbgyVSSfk X-Received: by 2002:a17:902:b40f:: with SMTP id x15-v6mr26606215plr.270.1528200760637; Tue, 05 Jun 2018 05:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528200760; cv=none; d=google.com; s=arc-20160816; b=1Bhi2RcPl0kjiW9800QDTVYhaoVWW7EezX77i8ifxmK7Vf3AVx1Zcg2vj3WOA5dtCU CGQhFM2JXeSnOx3vrMZkMpW3tHiA5d2X1qeuYYofPkscFRgsNXsdEpZt8BXGt0gKzQxe M6p2Snc5q2PYOFopEuYVm6w3Fn/zZ85xQO/cr3+LyRIJiMysWaR3Jica1DRkaEIOw6wT Y8ED2B+QtQNJ2k0NmWS2j63DP7aLmLmbcR58Xi+06J4364xSo1639MVkQoZQLjJqVd3K M5T0qhbeSuRe+B1Jp+LlPgk+ZxExV/vMkSP+uHdhbturaW1IF4AI/ofrR2yjVoVmwlkk GqqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=pL7e4CrpJmmQG0AvjbfUVp0EF49juBJOzAirS3g8Bw4=; b=yS9FGs3npu5cX8KPtdPY5fE+Eeig43aYnO7IjMlfDFe1LEkZMaQnqt0JAI7F9b/4Tj xqpazXjekihufE5gE9ZYXItT/o76B5TbGOs9P7j/YeZY+bNqcecRb0LxiMF4SpYgNZw3 20YR7BBQXYKwKaobjGAtvSCTPPTqt7hzrUSs3KDKb28N0J5wqZbC3cSzCbp57ElV2dPW sacxYA7dZ7UQTElDT28kxJFb3AXZ0T9bFUzSEhzt8zqpHCvEekPArbVGx7pAD+werUry GXSrS2gtLklGmT72ZLH67wEiEtRIQh2pMv3DEfqVlElL7aOS1Kj6GVTVnijZnO5T/4ZD gX5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w21-v6si47610842plp.199.2018.06.05.05.12.24; Tue, 05 Jun 2018 05:12:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751822AbeFEML7 (ORCPT + 99 others); Tue, 5 Jun 2018 08:11:59 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36110 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751644AbeFEML6 (ORCPT ); Tue, 5 Jun 2018 08:11:58 -0400 Received: by mail-wm0-f68.google.com with SMTP id v131-v6so4654481wma.1 for ; Tue, 05 Jun 2018 05:11:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pL7e4CrpJmmQG0AvjbfUVp0EF49juBJOzAirS3g8Bw4=; b=M1a9zcQe8s8NI8ky/efw+LuHj+XdANb4wGSgtWE6I3VUWqQgikxHhhyJobRbHAbx8L Zso+5X9bExo2bOXHEel2hUzOPTLWXH6skIxMEBrFzRqOVGvUMOCeZ/uAVYGIZR+QNbW3 HabTi9na2tEIuYgDtrPS3t1EPQH7am49qYbWnTjhaLX5i0mMRBbPlBh2w/yWijYpqUbH kv504cQvPSYBbLYT+8Cl+FGobaWRgK8/1didQnzaCbKx1kAlQwd8933zlWJ9wWIqmU16 VyHtoB59YOvZ78rtualu1N5h5Cdq1VVDsgbXoEQCYVJjI/NsO5mey5lhtlKay4LqV0Td SzaQ== X-Gm-Message-State: APt69E1jd7vUthRhcB5c6sW/ilSiAHFSNQIkwW7Z7JNPTJqha2HZqqqS rncZVwdnEsfVxgnKfulHPVj/7w== X-Received: by 2002:a1c:8301:: with SMTP id f1-v6mr8608509wmd.17.1528200717665; Tue, 05 Jun 2018 05:11:57 -0700 (PDT) Received: from localhost.localdomain ([151.15.207.242]) by smtp.gmail.com with ESMTPSA id c131-v6sm1551804wma.41.2018.06.05.05.11.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 05:11:56 -0700 (PDT) Date: Tue, 5 Jun 2018 14:11:53 +0200 From: Juri Lelli To: Quentin Perret Cc: Vincent Guittot , Peter Zijlstra , Ingo Molnar , linux-kernel , "Rafael J. Wysocki" , Dietmar Eggemann , Morten Rasmussen , viresh kumar , Valentin Schneider Subject: Re: [PATCH v5 00/10] track CPU utilization Message-ID: <20180605121153.GD16081@localhost.localdomain> References: <1527253951-22709-1-git-send-email-vincent.guittot@linaro.org> <20180605105721.GA12193@e108498-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180605105721.GA12193@e108498-lin.cambridge.arm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Quentin, On 05/06/18 11:57, Quentin Perret wrote: [...] > What about the diff below (just a quick hack to show the idea) applied > on tip/sched/core ? > > ---8<--- > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c > index a8ba6d1f262a..23a4fb1c2c25 100644 > --- a/kernel/sched/cpufreq_schedutil.c > +++ b/kernel/sched/cpufreq_schedutil.c > @@ -180,9 +180,12 @@ static void sugov_get_util(struct sugov_cpu *sg_cpu) > sg_cpu->util_dl = cpu_util_dl(rq); > } > > +unsigned long scale_rt_capacity(int cpu); > static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) > { > struct rq *rq = cpu_rq(sg_cpu->cpu); > + int cpu = sg_cpu->cpu; > + unsigned long util, dl_bw; > > if (rq->rt.rt_nr_running) > return sg_cpu->max; > @@ -197,7 +200,14 @@ static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) > * util_cfs + util_dl as requested freq. However, cpufreq is not yet > * ready for such an interface. So, we only do the latter for now. > */ > - return min(sg_cpu->max, (sg_cpu->util_dl + sg_cpu->util_cfs)); > + util = arch_scale_cpu_capacity(NULL, cpu) * scale_rt_capacity(cpu); Sorry to be pedantinc, but this (ATM) includes DL avg contribution, so, since we use max below, we will probably have the same problem that we discussed on Vincent's approach (overestimation of DL contribution while we could use running_bw). > + util >>= SCHED_CAPACITY_SHIFT; > + util = arch_scale_cpu_capacity(NULL, cpu) - util; > + util += sg_cpu->util_cfs; > + dl_bw = (rq->dl.this_bw * SCHED_CAPACITY_SCALE) >> BW_SHIFT; Why this_bw instead of running_bw? Thanks, - Juri