Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1703356pxu; Tue, 24 Nov 2020 07:02:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVXgvzrSh9S6gPPncS+mDwax+6iW+N1BexiYfhWaJooXD0+FvgM/BnbYLOnxVvYj1TB5a4 X-Received: by 2002:a17:907:d1f:: with SMTP id gn31mr4600944ejc.192.1606230159425; Tue, 24 Nov 2020 07:02:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606230159; cv=none; d=google.com; s=arc-20160816; b=zwLYqJK85lwbu87An5FnpLhq7Aog41K1EpgpCbfa8idDw51CTKas0Wab5inab5U2CU 6I3YaELjQUTM8hZEMec3g5P8VVdjoy9OkM4HmOwP2f5vRe2iZEyJJ5pTto1TBZe1Yley BajWfvIp0MxM7CxXJuKI/NEWP+17i8WrVf+EPPnfGYg/r4NTKRqWJkBkm8ru9luAvnKu BG6sd4clcs9nnzruIw4lfcyyPXtyDhkx+NWVZic4+v41sVPFCQ5buz96GU4LG2r73fTR arUXcYAGBLMYwBlwoo1FKZH6GwRRMQLqyd+7W+bfGK6P6UM7luUPT3KR/c9+ccvXPkqk HTMQ== 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=p5kyr3PF7N9ig0el/wLxZrzTERYsXtdp5Duc2xlDesw=; b=eOB21c6QvA0RvUMHYIgIke8teKDes5mPtLtZc3mhY+xapDXZVoE2zaDKZOg3IvAvjG mODPHHwezphk0JXBZJ20RBiiPy1HuP6Ixv7Rdf8ZJGEpDW8srXGNGJO/OslYhruQQzT4 eXmDqW8e9H+5kQ1E9KhLi9X7ySHXG2NqomXZID4etLsJCcgRJnnZZU4c/nmZrTU+7By/ 2fdVSrok8Wq245iKxf3A8J7sr7FIuzZttiyn+EFxIOgN24OB2lHzf8AxzPUyn5Vd+2fa lyCgM9b4Jy8NVCByvizMKN63hExzHQ7OjsbNZHiDX32uUeUsOxmBx2kUN6uNiJNO0fVD 8wug== 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 q7si8747136edc.249.2020.11.24.07.02.11; Tue, 24 Nov 2020 07:02:39 -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; 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 S2388695AbgKXO7o (ORCPT + 99 others); Tue, 24 Nov 2020 09:59:44 -0500 Received: from foss.arm.com ([217.140.110.172]:37778 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387670AbgKXO7o (ORCPT ); Tue, 24 Nov 2020 09:59:44 -0500 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 A7AB21396; Tue, 24 Nov 2020 06:59:43 -0800 (PST) Received: from [192.168.178.2] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2D9F13F70D; Tue, 24 Nov 2020 06:59:42 -0800 (PST) Subject: Re: [PATCH V3] PM / EM: Micro optimization in em_cpu_energy To: Pavankumar Kondeti , linux-kernel@vger.kernel.org Cc: Lukasz Luba , "Rafael J. Wysocki" , Quentin Perret , Daniel Lezcano , "Gustavo A. R. Silva" References: <1606127371-13828-1-git-send-email-pkondeti@codeaurora.org> <1606127734-14507-1-git-send-email-pkondeti@codeaurora.org> From: Dietmar Eggemann Message-ID: Date: Tue, 24 Nov 2020 15:59:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1606127734-14507-1-git-send-email-pkondeti@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/11/2020 11:35, Pavankumar Kondeti wrote: > When the sum of the utilization of CPUs in a performance domain is > zero, return the energy as 0 without doing any computations. > > Signed-off-by: Pavankumar Kondeti > --- > V3: %s/power/performance as corrected by Quentin > V2: Fixed the function name in the commit message. > > include/linux/energy_model.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h > index b67a51c..8810f1f 100644 > --- a/include/linux/energy_model.h > +++ b/include/linux/energy_model.h > @@ -103,6 +103,9 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd, > struct em_perf_state *ps; > int i, cpu; > > + if (!sum_util) > + return 0; > + > /* > * In order to predict the performance state, map the utilization of > * the most utilized CPU of the performance domain to a requested LGTM. Reviewed-by: Dietmar Eggemann