Tag Archives: up_threshold

Overclocking Raspberry Pi: Set scaling_governor on Raspbian boot

If you are trying to overclock your Raspberry, but CPU keeps running at same frequency, there may be a reason in aggressive scaling_governor set to “powersave”.

Check your scaling_governor:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

If the result is

powersave

its probably the reason why your overclocking in /boot/config.txt file is not working.

You can see the list of available scaling governors using next command:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative ondemand userspace powersave performance

Let do some tests.

Check the current frequency:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

The result is probably “700000”, which is default CPU frequency.

Lets make processor bussy and check its result:

for i in {1..10000} ; do set X 1; done && cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

The result is probably “700000” again.

Change the scaling governor:

su -c "echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"

Check your scaling_governor:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

The result should be

ondemand

Lets test it again:

for i in {1..10000} ; do set X 1; done && cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

Now, the result should be “800000”.

To change scaling_governor on boot, edit /etc/rc.local file:

sudo nano /etc/rc.local

Add next line, so file looks like:

echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
exit 0

Reboot:

sudo reboot

After reboot, test if scaling_governor is set to “ondemand”:
(Note: Wait few minutes before you issue next command. There is a delay before new scaling_governor is applied.)

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

The result should be:

ondemand

By default, CPU threshold is set to 95.

You can check it using:

cat /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
95

So, a threshold is set to 95. It means CPU speed will rise when CPU utilisation is 95%.

You can set this value to a lower percentage. It means CPU will be clocked higher when CPU utilisation is lower.
For example if you want to speed up your CPU at 60%, add next line to /etc/rc.local file.

echo 60 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold