Manage Intel Turbo Boost with systemd
If you have a little laptop with an Intel CPU that supports turbo boost, you might find that it’s getting a little hot when you’re using it on your lap.
For example, taking a look at my CPU:lscpu |egrep "Model name|MHz"
We can see that it’s a 2.7GHz CPU with turbo boost taking it up to 3.5GHz.
Model name: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
CPU MHz: 524.633
CPU max MHz: 3500.0000
CPU min MHz: 400.0000
Here’s a way that you can enable and disable turbo boost with a systemd service, which lets you hook it into other services or disable it on boot.
By default, turbo boost is on, so starting our service will disable it.
Create the service.
cat \ /sys/devices/system/cpu/intel_pstate/no_turbo" ExecStop=/bin/sh -c "/usr/bin/echo 0 > \ /sys/devices/system/cpu/intel_pstate/no_turbo" RemainAfterExit=yes EOF
Reload systemd manager configuration.sudo systemctl daemon-reload
Test it by running something CPU intensive and watching the current running MHz.cat /dev/urandom > /dev/null & lscpu |grep "CPU MHz"
CPU MHz: 3499.859
Now disable turbo boost and check the CPU speed again.
sudo systemctl start disable-turbo-boost lscpu |grep "CPU MHz"
CPU MHz: 2699.987
Don’t forget to kill the CPU intensive process
If you want to disable turbo boost on boot by default, just enable the service.
sudo systemctl enable disable-turbo-boost
本文系统（linux）相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统