Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp675214pxj; Wed, 2 Jun 2021 08:38:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1QE2LWHuTEkNxIJv34x45N+1hy4O7UXDqCLDS7eJfbmUAWtS+K3ukdOUXcMoeZjB1w8Tp X-Received: by 2002:a17:906:d85:: with SMTP id m5mr20782514eji.55.1622648334417; Wed, 02 Jun 2021 08:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622648334; cv=none; d=google.com; s=arc-20160816; b=Bf5zZXVWl6jquoWNhvyRgj4yXH1VkGJZ0QhtNwfGJJfk8YYKOYqcmPN3+VMFIJN/kQ duEAEIGYBfH+f7sGN0upnU1LKh34ST8kHNBADslYeK6McQZJ24GoiohexsReBNHKSs6b dO1w8BhmG6TstMfkkkutbFohmHhU/mfvS5MfZ12CKItefHvIsVD4Zv5pprVt9A1kEfet lyXd3ePC0yNgqj6JtOntlcRWSO4xyxAfEumNd706HSUmPIt2DMiR+vIbGzNidWe5vv+m dIe0HpBM64tuFmuv6w8FhDd65PF5HDQe8u8cVGiCX6z4AnvTOy1e7L9gd7BqVEFiLXRr f+8g== 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; bh=aIWe4Cw6y4igNqe0464gn1xhMw7JMBMgKSt4V89iW2g=; b=qHikaLBjbFYZGyIr5qoFlfpEfAdpbmVXZpVOBPKYu5PYxZrN5yckRhT68ujF088s8W YS09vcNpu8xD7fozp/aUIBmDlfwKbsl2u1iu0PNoYMm80NZVF+fZJpvEQkrCC/2/0K3Q +Y0lcwFiIzu1dyebvr+ic/bZG1sNRqkXINlrufTSGcF73+/g4csJGkkzYNpsTrV7JUIs 70LPn5TSkjZDlIDe2Xntz9U20CGLefA5a/+ehA18I1lXfQWYvOrs3guS9s0GqPShE2M0 5udrXW6ntYt8EhTaCRpooCf/87Fiuj6uDaSU0B53Huh2I6WoHHCy+F663zw3z6qkqMjD Z0/w== 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si180171ejk.111.2021.06.02.08.38.31; Wed, 02 Jun 2021 08:38:54 -0700 (PDT) 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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231618AbhFBPhO (ORCPT + 99 others); Wed, 2 Jun 2021 11:37:14 -0400 Received: from foss.arm.com ([217.140.110.172]:48010 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbhFBPhN (ORCPT ); Wed, 2 Jun 2021 11:37:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2C4A711FB; Wed, 2 Jun 2021 08:35:30 -0700 (PDT) Received: from [10.57.1.174] (unknown [10.57.1.174]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 253A23F719; Wed, 2 Jun 2021 08:35:26 -0700 (PDT) Subject: Re: [PATCH 1/2] sched/fair: Take thermal pressure into account while estimating energy To: Quentin Perret Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, peterz@infradead.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, vincent.donnefort@arm.com, mingo@redhat.com, juri.lelli@redhat.com, rostedt@goodmis.org, segall@google.com, mgorman@suse.de, bristot@redhat.com References: <20210602135609.10867-1-lukasz.luba@arm.com> <20210602135609.10867-2-lukasz.luba@arm.com> From: Lukasz Luba Message-ID: Date: Wed, 2 Jun 2021 16:35:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Quentin, On 6/2/21 4:00 PM, Quentin Perret wrote: > Hi Lukasz, > > On Wednesday 02 Jun 2021 at 14:56:08 (+0100), Lukasz Luba wrote: >> compute_energy(struct task_struct *p, int dst_cpu, struct perf_domain *pd) >> { >> struct cpumask *pd_mask = perf_domain_span(pd); >> - unsigned long cpu_cap = arch_scale_cpu_capacity(cpumask_first(pd_mask)); >> + unsigned long _cpu_cap = arch_scale_cpu_capacity(cpumask_first(pd_mask)); >> unsigned long max_util = 0, sum_util = 0; >> + unsigned long cpu_cap = _cpu_cap; >> int cpu; >> >> /* >> @@ -6558,6 +6559,14 @@ compute_energy(struct task_struct *p, int dst_cpu, struct perf_domain *pd) >> cpu_util_next(cpu, p, -1) + task_util_est(p); >> } >> >> + /* >> + * Take the thermal pressure from non-idle CPUs. They have >> + * most up-to-date information. For idle CPUs thermal pressure >> + * signal is not updated so often. >> + */ >> + if (!idle_cpu(cpu)) >> + cpu_cap = _cpu_cap - thermal_load_avg(cpu_rq(cpu)); > > This messes up the irq time scaling no? Maybe move the capping in this You are talking about scale_irq_capacity() which shrinks the util by some percentage of irq time. It might be different, by some fraction (e.g. 8/9 vs 9/10) compared to SchedUtil view, which passes 'raw' arch capacity. It then adds the irq part, but still to this slightly different base util. > function instead of relying on effective_cpu_util() to do it for you? Agree, since it would be more 'aligned' with how SchedUtil calls effective_cpu_util(). I will clamp the returned value. Thanks for pointing this out. Regards, Lukasz