All Products
Search
Document Center

:How do I resolve inconsistency between the CPU frequency in the /proc/cpuinfo file and the frequency specified for the instance?

Last Updated:Nov 08, 2024

This topic explains why inconsistency occurs between the CPU frequency displayed in the /proc/cpuinfo file and the frequency specified for the instance, and how to solve this inconsistency. Alibaba Cloud Linux 3 is used as an example.

Problem description

In the idle state, the CPU frequency displayed in the /proc/cpuinfo file is 800 MHz, which is inconsistent with the instance specification frequency, as shown below.

image

The solution described in this topic also covers the following kernels and operating systems:

Kernel/Operating System

Kernel/Operating System

Version

Linux kernel

5.11 and above

Debian

12.0 and above

Fedora

33.0 and above

Red Hat

9.0 and above

AlmaLinux

9.0 and above

CentOS Stream

9.0 and above

SLES/OpenSUSE

15.4 and above

Ubuntu

22.0 and above

Alibaba Cloud Linux

Alibaba Cloud Linux 3

Note

For information about optimizing CPU frequency retrieval through /proc/cpuinfo in Alibaba Cloud Linux 3, see Optimize the operation of reading the /proc/cpuinfo file to obtain the CPU frequency.

Cause

To enhance system performance and CPU response, a patch (commit ID: 3fcd6a230fa7d03bffcb831a81b40435c146c12b) was integrated into the Linux kernel starting with version 5.11.

 x86/cpu: Avoid cpuinfo-induced IPIing of idle CPUs

    Currently, accessing /proc/cpuinfo sends IPIs to idle CPUs in order to
    learn their clock frequency.  Which is a bit strange, given that waking
    them from idle likely significantly changes their clock frequency.
    This commit therefore avoids sending /proc/cpuinfo-induced IPIs to
    idle CPUs.

The function rcu_is_idle_cpu checks whether the CPU is in the idle state when /proc/cpuinfo is accessed. If the CPU is idle, it returns min_freq , which is defined by the kernel as 800 MHz by default. In some kernel versions, we get the value of min_freq as the CPU base frequency.

Solution

Note

The frequency displayed in the idle state may not match expectations, but the actual performance and usage are not affected, because the CPU can still reach the specification-defined frequency.

To obtain accurate frequency measurements, use tools such as cpupower or turbostat.

For example, the cpupower tool can be used to gather frequency data.

sudo cpupower frequency-info

The following output shows that the current CPU frequency is 3,200 MHz:

image

Important

Please note that some instance types may not support CPU frequency queries as described above. Refer to the Overview of instance families documentation for details on the base frequency of the specific instance.