Set persistent scaling governor performance

Ticket#2021032910000098

Hi, guys.

I need a help with set persistent scaling governor performance.

echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor

Where can I put this code to always be retentive or change when starting? It also requirement whenever you are a su user and should be done outside the container. Can you help me with this?

Thanks
Italo

Hi @italoaugustoandrade ,

One alternative should be creating a systemd service, please check the information provided on this article.

Best regards,

Daniel Morais

Hi @italoaugustoandrade,

I did this by mapping the exact folder into the container. This means you have a small amount of the host made available there which I think should be fine:

2671-screenshot-2021-04-02-093232.png

You can then access them from your code, I’m in Python.

with open('/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor', 'rt') as fp:
            current_governors['cpu0'] = fp.readline()

Happy to have better suggestions but this seems to work ok for me.

Thanks for your Input.