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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 68B2DC2D0E4 for ; Tue, 24 Nov 2020 17:16:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1FC322087C for ; Tue, 24 Nov 2020 17:16:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390511AbgKXRPl (ORCPT ); Tue, 24 Nov 2020 12:15:41 -0500 Received: from mga14.intel.com ([192.55.52.115]:50297 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390280AbgKXRPk (ORCPT ); Tue, 24 Nov 2020 12:15:40 -0500 IronPort-SDR: PBaeAwh+jpv6Is7fgpM7umK+aIptXBTwBzcz5Cv1uJri68OXhmIMxKH9LubrRPhMw2ptdaYBbw h3xL1K4uCi2Q== X-IronPort-AV: E=McAfee;i="6000,8403,9815"; a="171201662" X-IronPort-AV: E=Sophos;i="5.78,366,1599548400"; d="scan'208";a="171201662" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2020 09:15:40 -0800 IronPort-SDR: BL9/f2x7001UmbRYVr03aocEjYzrMKeRkqA0WVMRbanRqfUVFI6MfBIC0UV/K1vn9ZWv2TP9a/ n0E5yflx9oMg== X-IronPort-AV: E=Sophos;i="5.78,366,1599548400"; d="scan'208";a="546910675" Received: from rjwysock-mobl1.ger.corp.intel.com (HELO [10.249.133.99]) ([10.249.133.99]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2020 09:15:35 -0800 Subject: Re: [PATCH V2] PM / EM: Micro optimization in em_cpu_energy To: Pavankumar Kondeti , linux-kernel@vger.kernel.org Cc: Lukasz Luba , Quentin Perret , Daniel Lezcano , "Gustavo A. R. Silva" References: <1606126679-11799-1-git-send-email-pkondeti@codeaurora.org> <1606127371-13828-1-git-send-email-pkondeti@codeaurora.org> From: "Rafael J. Wysocki" Organization: Intel Technology Poland Sp. z o. o., KRS 101882, ul. Slowackiego 173, 80-298 Gdansk Message-ID: <671427cc-2abb-68eb-5e54-0851785efa84@intel.com> Date: Tue, 24 Nov 2020 18:15:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <1606127371-13828-1-git-send-email-pkondeti@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/23/2020 11:29 AM, Pavankumar Kondeti wrote: > When the sum of the utilization of CPUs in a power domain is zero, > return the energy as 0 without doing any computations. > > Signed-off-by: Pavankumar Kondeti > --- > 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 If I'm to take this, please resend it with a CC to linux-pm@vger.kernel.org (and with the tags you've received so far). Thanks!