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 <lirongq...@baidu.com>
---
 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

Reply via email to