From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36685C47083 for ; Wed, 2 Jun 2021 15:35:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 244D261263 for ; Wed, 2 Jun 2021 15:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231891AbhFBPhP (ORCPT ); Wed, 2 Jun 2021 11:37:15 -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