How can I upper limit my CPU frequency by a value?
cpufreq
offers fixing the frequency to a constant value, instead of letting it vary in a range.It also offers conservative, on demand, powersave, and performance. I don't know what they mean. but they don't limit the frequency either. What do the four settings mean actually? In other words, what are their policies?
Question 2: This answer is for the acpi-cpufreq CPU frequency scaling driver driver:
The way to check which CPU frequency driver you are using is to do:
The conservative mode has a slower load-versus-CPU-frequency response curve, meaning it takes a little more load on the CPU to before the CPU frequency climbs.
The ondemand mode has a faster load-versus-CPU-frequency response curve, meaning it takes a little less load on the CPU before the CPU frequency climbs.
The driver uses hysteresis, so the increasing and decreasing load versus CPU frequency curves are not the same.
The powersave mode locks the requested p-state at the lowest value for the processor. The result is the CPU is always at the lowest clock frequency.
performance mode locks the target pstate at the highest value for the processor. However, note that some processors can back-off under no load by themselves. For simplicity, just think of it as the CPU always being at the highest frequency.
Question 1: Yes, you can limit the upper frequency.
First get a list of the available frequencies (example from my computer):
Then decide what you want the maximum frequency to be, noting that it must be from the list. Then set it:
And repeat for all CPUs.
A script version might be preferred, run as sudo:
A oneliner temporary solution which may help in some cases;
Feel free to adapt the max number of CPU cores (here = 3) to yours.
Or even better, with the
-r
flag:From the man: