How do I permanently change the scaling governor from ondemand to performance?

As the title implies, I would like to know how do I permanently change the scaling governor from ondemand to performance? I was able to manually change it to performance but the change did not persist across a reboot.

https://openwrt.org/docs/guide-user/base-system/notuci.config#etcrclocal

Thank you. That did the trick. I put

echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor

inside of /etc/rc.local and rebooted. All is good. Thanks again!

Not what you asked, but you can also consider:

  1. increasing the sensitivity of the ondemand governor
  2. limiting the lower end of the ondemand governor to a higher frequency
    Link to both.
1 Like

Thank you. I will experiment with those and see if they suite my needs also. Thanks again!

No problem. If you want to analyze different settings for sensitivity, below is a little script you can run on your OW device to log the freqs and here is a python script to analyze them.

DTS=$(date +"%Y%m%d-%H%M%S")
file="/tmp/frequency_stats-$DTS"

# log once per sec for 10 min
for i in $(seq 1 600); do
 x=$(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq)
 echo $(( x / 1000 )) >> $file
 sleep 1s
done

Example data set:

% histogram.py -p < frequency_stats-20181006-025012
# NumSamples = 2485; Min = 384.00; Max = 1725.00
# Mean = 489.918310; Variance = 125822.111234; SD = 354.714126; Median 384.000000
# each ∎ represents a count of 30
  384.0000 -   518.1000 [  2258]: ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎ (90.87%)
  518.1000 -   652.2000 [    21]:  (0.85%)
  652.2000 -   786.3000 [     0]:  (0.00%)
  786.3000 -   920.4000 [    19]:  (0.76%)
  920.4000 -  1054.5000 [     0]:  (0.00%)
 1054.5000 -  1188.6000 [     0]:  (0.00%)
 1188.6000 -  1322.7000 [     0]:  (0.00%)
 1322.7000 -  1456.8000 [     0]:  (0.00%)
 1456.8000 -  1590.9000 [     0]:  (0.00%)
 1590.9000 -  1725.0000 [   187]: ∎∎∎∎∎∎ (7.53%)

Isn't this required for each core in your router? For example if you have a dual core router wouldn't you need this

echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo performance > /sys/devices/system/cpu/cpufreq/policy1/scaling_governor

1 Like

I get:
Sun Oct 7 14:23:16 2018 daemon.notice procd: /etc/rc.d/S95done: /etc/rc.local: line 1: can't create /sys/devices/system/cpu/cpufreq/policy0/scaling_governor: nonexistent directory
Sun Oct 7 14:23:16 2018 daemon.notice procd: /etc/rc.d/S95done: /etc/rc.local: line 2: can't create /sys/devices/system/cpu/cpufreq/policy1/scaling_governor: nonexistent directory

@tapper
Very few (supported) systems actually supports this, mvebu isn't one of those :wink:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.