Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp88969ybz; Tue, 28 Apr 2020 18:54:36 -0700 (PDT) X-Google-Smtp-Source: APiQypKz2fzQKLbFjlmV6RKIryuF3nvszsey4odpLgvTYwX9J22dBSAXpggsATXUnH8d+vYHvgEY X-Received: by 2002:a17:906:412:: with SMTP id d18mr546988eja.54.1588125275932; Tue, 28 Apr 2020 18:54:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588125275; cv=none; d=google.com; s=arc-20160816; b=gsnXiEOQSMLNVWDym9pgWiOwrp2vtZU8VuVvFU1RO7plkq6K5qYlIq4TqsWpZLphOK DIRDcnh2Cjt14DcZDJOPu97+/66U4S3KdIlUtcPtzMnxNSqMEE/mlE8nsIKlQZ3bF/ns 8W3qokvozEwbcWTc1nhWYsoozOfCUF0pofCR+MapINPOJVvWhtQZT0vY6s211UXbXh3I AO5GnUnQN0+V9rox0ohlOaEBA9x79sJ5RCBE0XJC37UT6ATVfzKHRRt5qpPxI5C2w9cN X33zfqPDvo68x9CGkOmJTbjtOVnE42WIAdelgjOZ0L988ZoYNkLSpyYzuy/h59o0lTQx aeUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from; bh=V2oCjJ6VyqUwxcw05QH8BPDnbvs2DJvd4JHmo7s0Lk0=; b=JpGGzwSaz9+81SsFZBHyylCdOS86HpRG/1tYYzZTUXYTPJsysLS256n/AuQtqZ5yLj 1iB2eiVGRDYjbE3VZFkJwGOaHyOtBCi9pvbtNb+59Pttpc26iCmeVEE/+pnTucy2sRxy 1sCPCm5T8Dcuv1kvRuj52o66VDu1nLqzg0BsSUHWEhm6HC1PSvSQpYqJvgNQy02Ax2Gt ruhnhJT8bJ6RF93iBkZvfaqtyFKzVig71lHL/E2K40Lykt3Qshdvt1bZjwBgz38g3DYE eV0NfmuKOUpdlazaKG27wNZcwL0BtMJaBDrVtdoLfBjTjw6D1S1wicpNzD56FWWoHWeq QLrw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j26si2744021ejt.88.2020.04.28.18.54.12; Tue, 28 Apr 2020 18:54:35 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726477AbgD2BuV (ORCPT + 99 others); Tue, 28 Apr 2020 21:50:21 -0400 Received: from mx140-tc.baidu.com ([61.135.168.140]:33259 "EHLO tc-sys-mailedm02.tc.baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726158AbgD2BuV (ORCPT ); Tue, 28 Apr 2020 21:50:21 -0400 Received: from localhost (cp01-cos-dev01.cp01.baidu.com [10.92.119.46]) by tc-sys-mailedm02.tc.baidu.com (Postfix) with ESMTP id 142A811C0063; Wed, 29 Apr 2020 09:50:07 +0800 (CST) From: Li RongQing To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, peterz@infradead.org, ggherdovich@suse.cz, linux-kernel@vger.kernel.org, rafael.j.wysocki@intel.com Subject: [PATCH] x86: move turbo_disabled() out of intel_set_max_freq_ratio Date: Wed, 29 Apr 2020 09:50:07 +0800 Message-Id: <1588125007-8799-1-git-send-email-lirongqing@baidu.com> X-Mailer: git-send-email 1.7.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org move the turbo_disabled before intel_set_max_freq_ratio, when turbo is disabled, the max frequency ratio is a const value, it is unnecessary to read MSR_TURBO_RATIO* msr to compute Signed-off-by: Li RongQing --- arch/x86/kernel/smpboot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index fe3ab9632f3b..8979c459df2f 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1987,7 +1987,7 @@ static bool intel_set_max_freq_ratio(void) out: arch_turbo_freq_ratio = div_u64(turbo_freq * SCHED_CAPACITY_SCALE, base_freq); - arch_set_max_freq_ratio(turbo_disabled()); + arch_set_max_freq_ratio(false); return true; } @@ -2009,6 +2009,9 @@ static void init_freq_invariance(void) if (smp_processor_id() != 0 || !boot_cpu_has(X86_FEATURE_APERFMPERF)) return; + if (turbo_disabled()) + return; + if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) ret = intel_set_max_freq_ratio(); -- 2.16.2