Changing CPU governor on NanoPi R6S

On the NanoPi R6S I have no idea how to change the cpu governor. I remember when I first had this device about 3 years ago. Before openwrt was officially supported for this device. FriendlyWRT had a package to change the governor through its GUI. Since I am on openwrt I want to check what the current governor is set to but also have the ability to change it. If someone can teach me on how to do this. It would be awesome.

Those values are usually in the cpufreq policy:

$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors
ondemand performance schedutil

$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
schedutil

To change it, just pick one of the "available" values and write it to the governor.

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

Poke around in that same policy0 directory and you'll find all the related stuff.

Will it change the governor for all the cores or I have to do this one by one?

Not sure, but I think writing to policy0 changes all the cores, that seems to be how it works on the ones I tested anyhow. Looks like it depends on the hardware: https://docs.kernel.org/admin-guide/pm/cpufreq.html#cpufreq-policy-objects

Ohhh ok I’ll do some research then.

You can check whether the cores are grouped by listing the policies first: ls -d /sys/devices/system/cpu/cpufreq/policy*. On many ARM boards one policy covers a cluster, not necessarily every core, so if you see policy0 and policy4 (for example) set both. I’d also test by reading scaling_governor after a reboot, because it may not persist unless you add it to a small startup script.

On my systems, I have a /etc/sysfs.d/rk3588.conf file with contents:

devices/system/cpu/cpufreq/policy0/scaling_governor = performance
devices/system/cpu/cpufreq/policy4/scaling_governor = performance
devices/system/cpu/cpufreq/policy6/scaling_governor = performance

add to rc.local (startup) -

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

for policy in 0 4 6; do
    gov="/sys/devices/system/cpu/cpufreq/policy${policy}/scaling_governor"
    [ -f "$gov" ] && echo performance > "$gov" 2>/dev/null
done

exit 0