centos7限制cpu使用_CentOS7中CPU频率调整问题

本文介绍了在 CentOS7 中遇到的 CPU 使用限制问题,特别是 intel_pstate 驱动带来的影响。讨论了如何禁用 intel_pstate 以及选择 powersave 和 performance 两种管理模式。建议使用 'cpupower frequency-set -g powersave' 或 'performance' 来设定固定频率,并指出在某些场景下,如要求稳定性能或压力测试,可能需要固定频率的设置。
摘要由CSDN通过智能技术生成

cpufreq使用了新的intel_pstate驱动造成的困惑,详细解答在这里

Take a look at this discussion:

https://plus.google.com/117091380454742934025/posts/2vEekAsG2QT

1. intel_pstate can be disabled at boot-time with intel_pstate=disable or compile it out

2. the old problem with ondemand (and conservative) governors is and was, that they don't know the specific capabilities of the cpu

3. executing some tasks with highest-frequency possible is consuming less power, than taking more time with lower frequency e.g. arithmetic stuff

4. this is not true for all tasks e.g. loading something from main-memory

5. here comes intel_pstate: it knows how the specific cpu works and does it job better than a generic solution, also it seems to handle "boost" better

6. furthermore intel_pstate offers only two governors: powersave and performance

even "powersave" is faster than the generic acpi based approach with "performance" (maybe handles "boost" better)

also "performance" doesn't enforce the default frequency as "lower limit", like the old generic approch, but performance is anyway only ~ 1% faster

You can still select between these two governors with "cpupower frequency-set -g powersave/performance".

Run CPU with fixed frequency

Your good right. You paid for it! There are some good reasons for this:

Requirement of 100% reliable performance and answer-times

Bbenchmarking/Comparsion

Stress-Testing e.g. is CPU never throttled with your provided cooling solution

That is simple, set intel_pstate=disable at boot or remove it from your self compiled kernel. Now you can use the old generic acpi-based generic governors.

Or: Switch Powersave/Boost off in your BIOS/UEFI. This is what I do on desktops.

I will stay with intel_pstate and the default governor "powersave". It seems to do a good job at power-saving and my ThinkPad even runs faster smile

Maybe it would be less confusing if intel_pstate also overs a "fixed" governor which forces the default-frequencies. But this is merely "intel_pstate=disable".

在CentOS 7调整CPU主频通常涉及到调整CPU频率调节器(CPU frequency scaling governor),这个调节器控制CPU的工作频率。CentOS 7默认使用的是`ondemand`调节器,它会根据CPU负载自动调整频率。如果你需要手动设置CPU频率,可以按照以下步骤操作: 1. 首先,查看当前的CPU频率调节器: ``` $ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor ``` 2. 安装`cpufrequtils`软件包,它提供了一些用于调节CPU频率的工具: ``` $ sudo yum install cpufrequtils ``` 3. 要设置特定的CPU频率调节器,可以使用`cpufreq-set`命令。例如,如果你想要使用`performance`模式(即始终以最大频率运行),可以执行: ``` $ sudo cpufreq-set -c 0 -g performance ``` 这里的`-c 0`指定了CPU的核心编号(在这个例子是第一个CPU核心),`-g performance`指定了使用`performance`调节器。 4. 如果你想设置CPU的最大和最小频率,可以使用`-r`选项(设置CPU的运行频率范围): ``` $ sudo cpufreq-set -c 0 -r 1000000 -r 3000000 ``` 这个例子CPU核心0的频率将被设置为1GHz到3GHz之间。 5. 要检查设置是否成功,可以再次查看`/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor`文件或使用以下命令查看当前频率: ``` $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq ``` 请注意,这些操作可能需要root权限,并且在某些系统上,可能需要禁用CPU的节能功能或关闭某些电源管理功能才能成功设置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值