Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1286416pxf; Fri, 9 Apr 2021 04:59:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUoGXw3pYZVgKKZ/mLhdOmwR/cDYiG+4Jc/Zg9KBBuPlx8w2MgdCcEJrJ50sUrQru2ru/G X-Received: by 2002:a17:907:2069:: with SMTP id qp9mr16246103ejb.175.1617969569509; Fri, 09 Apr 2021 04:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617969569; cv=none; d=google.com; s=arc-20160816; b=sj4aS2B2gfGjr9v0UuNtLJc1cOxiiMrUof+ud/OzyvyKD94YZq8hhsbn0G7mu3GpOF VCHOI19Tgc2cXZ76ptq4oYyRsUwGMa56ag5KG/Ziph1rgmVKCNrZvOwPcnOFby0n5woD FguNMB2YtZni2S846wHFArvNfYu1YI1YzPvOycDT/q/1XOiyYNgplfmN4f5+xkQ7lihB XxxbmysZK0u4438IGvU+71Mq0b7Ul/jESQfcVcLNDPoYy5oCM8Hcfjh6tKZl5W/J6e5A qRY5qJMdq8IWSuIon9LMJ4E0GnVw0EsanQkyAOcpU90tt/xPVZbJbLs7gPHch90obrb6 CuWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=IQ3W78mFOgF1k2PGL8HMDHIi0IyGNABNsSx67MCmdmk=; b=hPHZ0GiIIFUiS5OtV51X+w0HsUAU5mpz/7oABKmJfZaSo2KqWN+/NfO97VE8XCXtUw VZLKC5A31D1IPHB6JJKIUFhTyau0Etq9JaptgNTRgCBO96x3m5IQiQbT5w0EHx1uQ3Cy lKIkknmmZ4sT/jayUEG4BdVlImGBoIoOzQM2tdXQ67EUeIXYTxUeU5mdlfx6Iq17+VtM djt6ggn7aHK4cpwkAxUeELQkGgmHfcuQAcTH6xnwOwydL/HUucq9AFW2dInc79exKzC5 iHwhxokciMWrufbLFIR+3ok4PtTFWTmxfXNchUudl2/4O3eSVr7/yuz/IZ4gdyJKS+Ab ktUw== 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 gz3si2017933ejb.227.2021.04.09.04.59.06; Fri, 09 Apr 2021 04:59:29 -0700 (PDT) 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 S233506AbhDIL6P (ORCPT + 99 others); Fri, 9 Apr 2021 07:58:15 -0400 Received: from mga11.intel.com ([192.55.52.93]:4320 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233838AbhDIL6O (ORCPT ); Fri, 9 Apr 2021 07:58:14 -0400 IronPort-SDR: TZb+Kap/wx8uKo/oSuzcd6f/iOUDge2G6JCfLOovsGnfaioHTyg36q1b4QJikgfb7wgUAxfln7 qHThbYdkxYXw== X-IronPort-AV: E=McAfee;i="6000,8403,9948"; a="190546815" X-IronPort-AV: E=Sophos;i="5.82,209,1613462400"; d="scan'208";a="190546815" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2021 04:58:01 -0700 IronPort-SDR: sExNdMNJgxTZOJB478Bjt/IzpOobnLLdAjfirJrL7gvmBwfQWc9rBSgrWDPGNM0aZfXT/A3tWh /OssJJVFcpRw== X-IronPort-AV: E=Sophos;i="5.82,209,1613462400"; d="scan'208";a="613694408" Received: from chenyu-desktop.sh.intel.com (HELO chenyu-desktop) ([10.239.158.173]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2021 04:57:59 -0700 Date: Fri, 9 Apr 2021 20:01:57 +0800 From: Chen Yu To: "Rafael J. Wysocki" Cc: Linux PM , LKML , Srinivas Pandruvada , Zhang Rui Subject: Re: [PATCH] cpufreq: intel_pstate: Simplify intel_pstate_update_perf_limits() Message-ID: <20210409120157.GA229488@chenyu-desktop> References: <5450142.DvuYhMxLoT@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5450142.DvuYhMxLoT@kreacher> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 07, 2021 at 04:21:55PM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Because pstate.max_freq is always equal to the product of > pstate.max_pstate and pstate.scaling and, analogously, > pstate.turbo_freq is always equal to the product of > pstate.turbo_pstate and pstate.scaling, the result of the > max_policy_perf computation in intel_pstate_update_perf_limits() is > always equal to the quotient of policy_max and pstate.scaling, > regardless of whether or not turbo is disabled. Analogously, the > result of min_policy_perf in intel_pstate_update_perf_limits() is > always equal to the quotient of policy_min and pstate.scaling. > > Accordingly, intel_pstate_update_perf_limits() need not check > whether or not turbo is enabled at all and in order to compute > max_policy_perf and min_policy_perf it can always divide policy_max > and policy_min, respectively, by pstate.scaling. Make it do so. > > While at it, move the definition and initialization of the > turbo_max local variable to the code branch using it. > > No intentional functional impact. > > Signed-off-by: Rafael J. Wysocki Tested-by: Chen Yu