Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2046465pxu; Tue, 24 Nov 2020 15:46:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzIUNExUHJkUZXBZHQVx5+qPNtdUiyxHc4DvypU1CH4F1dQQ7hIwnh6wPbVRFPfZpOlMlp X-Received: by 2002:a17:906:468d:: with SMTP id a13mr797732ejr.253.1606261562037; Tue, 24 Nov 2020 15:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606261562; cv=none; d=google.com; s=arc-20160816; b=fxdb/hWHjSNlJDg5rDWT5H2ILYJtDKraV167RM8v5Xfk2VeoAnrEnjnsR0GKTpfCkm 7DS0d5cY0V6QtZEUGzxvkcDeg7JnKdMUE5C5idrLUHj+jB0SNPMrHJO1zMtQBnmImwsY 0O322clYvxz+m38kSct+nTLsVQzuuntWvVV7VKTWeyzrFkdVvoVQAgzqGFbNllx9BTwf 75QmgU02zx9uUuozO7U7XV1y0Af3JoW+jDj4sW+K1r4E1wjoSUYA1McWywud8Fxco9ai 1qIWEM7OPRB37Iea7As19Ft6i+cmiSeJyRvqxY3e12Ug3QzKC53GCE247EtHF1xhPvxY cUkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=hIcT78HYERp1/cqiPkV1CUs80n9/52Vgn09el043gqw=; b=Tov/DtJm4olvaXyeLVJywi06oLi9lmfD6CxgtLwZpnrSImoaa/8yTULrVtaw0405LZ 7XnDwlrJltGqDmWt9R5tQ2Qqn5UxYwllweWfsCkip0/r4qY8oG44bhCrSYCiy37/aRS/ MuCeEpXyaqhC4P7+x/9SIl9zomnpsLMV0BBmv818p7CxgNDeO/6kycN5vAQUvc4Mgp8Q NG5Q9H4T67Wi99GRgr98CBSMJpUNRcdrG7uKbycJVwvAHPY3tKpRkF5iU/CEHjauR1SY EU1cvlS3R1vT0EWQ3xw66bVV+NNpa58MgbUu5YRvXBPBpy7LralHKtIzvxBYFtWWlAoi NUHQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ox26si260350ejb.107.2020.11.24.15.45.39; Tue, 24 Nov 2020 15:46:02 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390412AbgKXRPl (ORCPT + 99 others); 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!