Linux ARM 关闭CPU核心 调整CPU频率

缘由

手里的一块全志 H3 ARM开发板, 啥都不干, CPU烫的厉害。
系统里运行的业务很闲,不需要很高的性能。

干脆,关掉3个核心, 只开启一个CPU核心, 再设置为最省电的模式。

关闭其他核心

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
root@localhost:~# echo 0 > /sys/devices/system/cpu/cpu3/online
root@localhost:~# echo 0 > /sys/devices/system/cpu/cpu2/online
root@localhost:~# echo 0 > /sys/devices/system/cpu/cpu1/online




验证:
root@localhost:~# lscpu
Architecture: armv7l
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0
Off-line CPU(s) list: 1-3
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
Model name: ARMv7 Processor rev 5 (v7l)
CPU max MHz: 1008.0000
CPU min MHz: 480.0000
root@localhost:~#

设置CPU运行模式

1
2
3
4
5
6
7
8
9
10
11
12
13
root@localhost:~# echo powersave  > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor




验证:
root@localhost:~# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq
480000
root@localhost:~# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
480000
root@localhost:~# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
1008000
root@localhost:~#

ARM H3 CPU的温度

1
2
3
root@localhost:~# cat /sys/devices/virtual/thermal/thermal_zone0/temp
40701
root@localhost:~#