mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-08-31 22:12:51 +08:00
update PVE系统调整.md.
This commit is contained in:
+81
@@ -103,3 +103,84 @@ Wed, 20 Jul 2022 16:21:28 +0800
|
|||||||
```
|
```
|
||||||
|
|
||||||
输出结果如果和北京时间一致,则代表修改正确。
|
输出结果如果和北京时间一致,则代表修改正确。
|
||||||
|
|
||||||
|
|
||||||
|
## 3.CPU调度器配置
|
||||||
|
|
||||||
|
安装好 `cpufrequtils` 后,先检查当前 CPU 的调度器:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 检查 CPU 当前调度器
|
||||||
|
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_cpufreq
|
||||||
|
CPUs which run at the same hardware frequency: 0
|
||||||
|
CPUs which need to have their frequency coordinated by software: 0
|
||||||
|
maximum transition latency: 20.0 us.
|
||||||
|
hardware limits: 800 MHz - 2.90 GHz
|
||||||
|
available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
|
||||||
|
current policy: frequency should be within 800 MHz and 2.90 GHz.
|
||||||
|
The governor "ondemand" may decide which speed to use
|
||||||
|
within this range.
|
||||||
|
current CPU frequency is 952 MHz.
|
||||||
|
```
|
||||||
|
|
||||||
|
这里面主要关注两个点:
|
||||||
|
- driver: intel_cpufreq
|
||||||
|
- current policy: governor "ondemand"
|
||||||
|
|
||||||
|
当然还有另外一个命令可以用来显示 CPU 调度器:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 检查 CPU 当前调度器
|
||||||
|
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||||
|
|
||||||
|
## 参考输出
|
||||||
|
ondemand
|
||||||
|
```
|
||||||
|
|
||||||
|
驱动一般不建议手动调整,而 `governor "ondemand"` 则显示了当前 CPU 的调度器是什么。
|
||||||
|
|
||||||
|
接下来,我们需要了解当前系统的 CPU 支持的调度器有哪些:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 检查 CPU 调度器支持情况
|
||||||
|
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
|
||||||
|
|
||||||
|
## 参考输出
|
||||||
|
conservative ondemand userspace powersave performance schedutil
|
||||||
|
```
|
||||||
|
|
||||||
|
这里有很多种调度器可供选择,至于每种调度器有什么优劣,欢迎大家深度挖掘。
|
||||||
|
|
||||||
|
本教程以使用 `schedutil` 调度器为演示。
|
||||||
|
|
||||||
|
使用 `vim` 编辑器来编辑 `cpufrequtils` 的配置文件:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 修改 cpufrequtils 配置文件
|
||||||
|
vim /etc/init.d/cpufrequtils
|
||||||
|
|
||||||
|
## 找到 GOVERNOR="ondemand" 修改为以下内容
|
||||||
|
GOVERNOR="schedutil"
|
||||||
|
```
|
||||||
|
|
||||||
|
按 `i` 键进入编辑模式,`esc` 键退出编辑模式,`:wq` 命令保存退出。
|
||||||
|
|
||||||
|
修改完成后,需要重新启动 PVE 服务器来使参数生效。
|
||||||
|
|
||||||
|
PVE 服务器重启完成后记得重新检查当前 CPU 的调度器,看配置文件是否生效。
|
||||||
|
|
||||||
|
这里提供两个命令,分别来实时查看当前 CPU 的频率和内部温度传感器的数值:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 查看 CPU 当前频率
|
||||||
|
watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq
|
||||||
|
|
||||||
|
## 查看内部温度
|
||||||
|
watch sensors
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user