CPU frequency control

13,057

Solution 1

You can set maximum and minimum frequencies by setting /sys/devices/system/cpu/cpu**N**/cpufreq/scaling_min_freq and /sys/devices/system/cpu/cpu**N**/cpufreq/scaling_max_freq

Details are described in this document: https://software.intel.com/sites/default/files/comment/1716807/how-to-change-frequency-on-linux-pub.txt

Edit: You can reach the same using cpufreq-set in cpufrequtils package: https://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufreq-set.html

Solution 2

Question 1: How can I manually set the maximum allowed cpu frequency?

For example, to set the maximum frequency to 60 percent of either 3.5 GHz (turbo disabled) or 3.9 GHz (turbo enabled):

echo "60" | sudo tee /sys/devices/system/cpu/intel_pstate/max_perf_pct

Question 2: I see that ALL four cores are constantly at 3.9 ghz, which should [NOT] be impossible. How's that?

They are not all active at the same time. There is only 1 PLL, and all CPUs are always at the same frequency. If you are seeing 3.9GHz, then only 1 CPU was in the C0 state at the time the sample was taken.

Solution 3

everything mentioned here above works if your kernel has the correct modules loaded :

# CPU frequency control Driver
modprobe acpi_cpufreq
modprobe mperf
# CPU Frequency scaling modules
modprobe cpufreq_conservative
modprobe cpufreq_ondemand
modprobe cpufreq_performance
modprobe cpufreq_powersave
modprobe cpufreq_stats
modprobe cpufreq_userspace
modprobe freq_table
Share:
13,057

Related videos on Youtube

MadHatter
Author by

MadHatter

Updated on September 18, 2022

Comments

  • MadHatter
    MadHatter over 1 year

    I have a kubuntu 14.04 with the latest HWE kernel (3.16.0-31-generic), and a Xeon 1246v3 processor (which is basically an i7 4770 with ecc support). The processor has base frequency of 3.5 ghz, and max turbo frequency of 3.9 ghz.

    I have the following questions:

    1) I have intel p-states enabled by default, which is fine, but you know that with p-states you only get two governors: performance, and powersave. How can I manually set the maximum allowed cpu frequency?

    2) As stated above, the cpu should be able to run at 3.9 only with one core loaded. With full load on all cores, it should not be able to go over 3.5 ghz. But if I issue the command watch -n 0 "cat /proc/cpuinfo | grep -i mhz" , I see that ALL four cores are constantly at 3.9 ghz, which should be impossible. How's that?

    Thanks!

  • MadHatter
    MadHatter about 9 years
    Useful answer, but look what happens: cat: /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequ‌​encies: No such file or directory. I think this is because i have p-states enabled..
  • Jakub Lucký
    Jakub Lucký about 9 years
    @MadHatter: yes, that seems to be the problem. According to documentation, with P-state there is no way you can control frequency of the processor: kernel.org/doc/Documentation/cpu-freq/intel-pstate.txt (see last but one article)...
  • MadHatter
    MadHatter about 9 years
    well, I'll try to disable p-states. Thanks, anyway...
  • MadHatter
    MadHatter almost 9 years
    About question 1: I don't use pstates. What file should I address? Thanks.
  • Doug Smythies
    Doug Smythies almost 9 years
    I thought the question was for when using the intel_pstate frequency scaling driver. If you are using the acpi-cpufreq frequency scaling driver then use Jakup's answer.