Ubuntu 设置
与开机项有关的参数设置在 /etc/default/grub,可以对其进行调整
cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
然后找到 GRUB_CMDLINE_LINUX_DEFAULT 所在的那行,增加配置
processor.max_cstate=0
intel_idle.max_cstate=0
sudo vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash processor.max_cstate=0 intel_idle.max_cstate=0"
然后更新 grub
sudo update-grub
另外可以设置CPU的scale-governor
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
## 设置CPU模式, 分别根据CPU 0-n 的编号进行设置
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
systemctl disable ondemand
/etc/rc.local
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
重启后即可实现超频。
sudo reboot now
使用命令
cpufreq-info 查看当前 CPU 运行
cpufreq-set 也可以进行单独设置
cpufreq-aperf 用于计算一段时间内的平均频率
sudo apt install cpufrequtils
## 查看当前运行
cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: intel_pstate
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 4294.55 ms.
hardware limits: 800 MHz - 3.60 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.60 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 1.52 GHz.
analyzing CPU 1:
driver: intel_pstate
CPUs which run at the same hardware frequency: 1
CPUs which need to have their frequency coordinated by software: 1
maximum transition latency: 4294.55 ms.
hardware limits: 800 MHz - 3.60 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.60 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 2.66 GHz.
analyzing CPU 2:
driver: intel_pstate
CPUs which run at the same hardware frequency: 2
CPUs which need to have their frequency coordinated by software: 2
maximum transition latency: 4294.55 ms.
hardware limits: 800 MHz - 3.60 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.60 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 960 MHz.
analyzing CPU 3:
driver: intel_pstate
CPUs which run at the same hardware frequency: 3
CPUs which need to have their frequency coordinated by software: 3
maximum transition latency: 4294.55 ms.
hardware limits: 800 MHz - 3.60 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 3.60 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 1.05 GHz.