Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4594252iob; Sun, 8 May 2022 18:35:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4h+lZyUB8e8e+RT04/dYCpbpIulEoOACuWTAczTU6u8FqwHoPmaBB1e+GMPzDLM/T88Qa X-Received: by 2002:a65:6bc4:0:b0:3c2:2f7c:cc74 with SMTP id e4-20020a656bc4000000b003c22f7ccc74mr11232469pgw.307.1652060121460; Sun, 08 May 2022 18:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652060121; cv=none; d=google.com; s=arc-20160816; b=0l6HCXuAITnSS5fnpavokX61yl9t2vQLfZy8cHUdSKMMcdjaMCa5p6+xgK71fHCKKr dJD9KQHG4FcAezNcCK2PueEeRCYXtoEX52JkQq6WGEPkVeWK7a8+SYo9IJO/ELUV1wNS kTeI+IJAZsBgFZ/R1fSdP/n6shNYFyI2DAtn7RtWfhhQevH2KgFdiBmfgPlspwv2clI1 Z+9DLDB+LIFewqzs1J8zDHvupMTqxGTTMTjTF4FnGcS1XaEroAS2oB0nbKq/jLI6V/LD MXz9WOMhs7ajEPGsU4Qytz+ES4vXEk+UXYwmx/yQzhuvIv491u+KmrFNGMLfeO1LrSwx WNWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=t5BtdJfukw9GLhvD+GCJAPetD6NCPR6BnSFU5Knlv24=; b=h7aUSzyLwJbITGQieIi2sh6+/9mIUSpOtuhtoVXAQCSHJdDwRHP1BMGCMixBFs1/Gk qcgjZdYepSBzqM0iWWZ06+dEr2tk3kiGcAOOzbWIpnxg2GB8E+XvkyrEiZ+M/xv8nj2h 9ogWa/mqSTTDbA3hCJrbEC8xAhCmLvO48JGqlsi8njZKp/YL4x0o/RhSqNu14T+mi8Se 7Q7Am/nrjMsjWwkrxyB57lYIq6HM2GLXc6OBNa9JGot4LdEeyzPvJdT4L/xdGiDhq1QM JAurnGmb0Dd6OkKFwBJNmXJL91oGB41MeP7Z0sjV5DuwLEomAUUZv5N6lynOYid6lJh+ cC+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p8-20020a170902bd0800b0015efa7c371asi6524159pls.208.2022.05.08.18.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 18:35:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CF6283136C; Sun, 8 May 2022 18:35:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381422AbiEEStz (ORCPT + 99 others); Thu, 5 May 2022 14:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384764AbiEESsZ (ORCPT ); Thu, 5 May 2022 14:48:25 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB56F14035 for ; Thu, 5 May 2022 11:41:52 -0700 (PDT) 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 C3AAA106F; Thu, 5 May 2022 11:41:52 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 370603FA31; Thu, 5 May 2022 11:41:51 -0700 (PDT) Message-ID: Date: Thu, 5 May 2022 20:41:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v8 6/7] sched/fair: Remove task_util from effective utilization in feec() Content-Language: en-US To: peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org, vdonnefort@gmail.com Cc: linux-kernel@vger.kernel.org, morten.rasmussen@arm.com, chris.redpath@arm.com, qperret@google.com, tao.zhou@linux.dev References: <20220429141148.181816-1-vincent.donnefort@arm.com> <20220429141148.181816-7-vincent.donnefort@arm.com> From: Dietmar Eggemann In-Reply-To: <20220429141148.181816-7-vincent.donnefort@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + vdonnefort@gmail.com - vincent.donnefort@arm.com On 29/04/2022 16:11, Vincent Donnefort wrote: [...] > Signed-off-by: Vincent Donnefort Reviewed-by: Dietmar Eggemann [...] > -static long > -compute_energy(struct task_struct *p, int dst_cpu, struct cpumask *cpus, > - struct perf_domain *pd) > +static inline void eenv_task_busy_time(struct energy_env *eenv, > + struct task_struct *p, int prev_cpu) > { > - unsigned long max_util = 0, sum_util = 0, cpu_cap; > + unsigned long max_cap = arch_scale_cpu_capacity(prev_cpu); > + unsigned long irq = cpu_util_irq(cpu_rq(prev_cpu)); > + > + if (unlikely(irq >= max_cap)) { > + eenv->task_busy_time = max_cap; > + return; > + } > + > + eenv->task_busy_time = > + scale_irq_capacity(task_util_est(p), irq, max_cap); Nit-pick: Maybe a little bit lighter: static inline void eenv_task_busy_time(struct energy_env *eenv, struct task_struct *p, int prev_cpu) { - unsigned long max_cap = arch_scale_cpu_capacity(prev_cpu); + unsigned long busy_time, max_cap = arch_scale_cpu_capacity(prev_cpu); unsigned long irq = cpu_util_irq(cpu_rq(prev_cpu)); - if (unlikely(irq >= max_cap)) { - eenv->task_busy_time = max_cap; - return; - } + if (unlikely(irq >= max_cap)) + busy_time = max_cap; + else + busy_time = scale_irq_capacity(task_util_est(p), irq, max_cap); - eenv->task_busy_time = - scale_irq_capacity(task_util_est(p), irq, max_cap); + eenv->task_busy_time = busy_time; } [...] > +static inline unsigned long > +compute_energy(struct energy_env *eenv, struct perf_domain *pd, > + struct cpumask *pd_cpus, struct task_struct *p, int dst_cpu) > +{ > + unsigned long max_util = eenv_pd_max_util(eenv, pd_cpus, p, dst_cpu); > + unsigned long busy_time = eenv->pd_busy_time; > + > + if (dst_cpu >= 0) > + busy_time = min(eenv->pd_cap, > + eenv->pd_busy_time + eenv->task_busy_time); Nit-pick: if (dst_cpu >= 0) - busy_time = min(eenv->pd_cap, - eenv->pd_busy_time + eenv->task_busy_time); + busy_time = min(eenv->pd_cap, busy_time + eenv->task_busy_time); [..] > @@ -6905,12 +6976,14 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) > continue; > > /* Compute the 'base' energy of the pd, without @p */ > - base_energy_pd = compute_energy(p, -1, cpus, pd); > + eenv_pd_busy_time(&eenv, cpus, p); Nit-pick: Move comment /* Compute the 'base' energy of the pd, without @p */ here since eenv->pd_busy_time is also used to calculate prev_delta and cur_delta. > + base_energy_pd = compute_energy(&eenv, pd, cpus, p, -1);> base_energy += base_energy_pd; [...]