Enabling the Performance CPU Governor on System Boot
The set CPU governor are likely to be resetted back on boot. The following steps would ensure that the settings you decide, would stay put across system restarts.
- Navigate to
/usr/local/bin/
- Create a shell script file named
perf-prof.sh
here with the following content.
#!/bin/bash echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
- Make the script executable by running the following command
sudo chmod 744 /usr/local/bin/perf-prof.sh
- Navigate to
/etc/systemd/system/
- Create a systemd service file named
perf-prof.service
here with the following content.[Unit] After=network.target [Service] ExecStart=/usr/local/bin/perf-prof.sh [Install] WantedBy=default.target
- Set permissions for the systemd service file by running the following command.
sudo chmod 664 /etc/systemd/system/perf-prof.service
- Reload the systemd daemon by running the following command.
sudo systemctl daemon-reload
- Enable the service which you just created
sudo systemctl enable perf-prof.service
- Start the service
sudo systemctl start perf-prof.service
- Check your current CPU governor - if it is
performance
, you were successfully able to set up the script.cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
You can use the similar instructions for switching up to any CPU governor of your liking on boot. Just switch the CPU governor name in the shellscript file mentioned in step #2.
This is a draft writeup for a candidate entry in Quick Docs - an issue for which you can find here, awaiting triage.