news 2026/9/8 21:13:30

linux设置CPU固定频率

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
linux设置CPU固定频率

安装 cpupower 软件

sudoaptinstalllinux-tools-common linux-tools-$(name-r)

设置linux系统cpu固定频率,报如下错误:

$sudocpufreq-set-c0-f1000MHz Error setting new values. Common errors: - Do you have proper administration rights?(super-user?)- Is the governor you requested available and modprobed? - Trying tosetan invalid policy? - Trying toseta specific frequency, but userspace governor is not available,forexample because of hardwarewhichcannot besetto a specific frequency or because the userspace governor isn't loaded?

从Ubuntu使用intel某些cpu的pc上默认使用intel_pstate cpufreq driver。后果就是只有performance和powersave两个governor可用。可通过下面命令确认:

$ cpufreq-info cpufrequtils 008: cpufreq-info(C)Dominik Brodowski2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU0: driver: intel_pstate CPUswhichrun at the same hardware frequency:0CPUswhichneed to have their frequency coordinated by software:0maximum transition latency:4294.55ms. hardware limits:800MHz -3.90GHZ available cpufreq governors: performance, powersave current policy: frequency should be within800MHz and3.90GHz. The governor"powersave"may decidewhichspeed to use within this range. current CPU frequency is800MHz. analyzing CPU1: driver: intel_pstate CPUswhichrun at the same hardware frequency:1CPUswhichneed to have their frequency coordinated by software:1maximum transition latency:4294.55ms. hardware limits:800MHz -3.90GHZ available cpufreq governors: performance, powersave current policy: frequency should be within800MHz and3.90GHz. The governor"powersave"may decidewhichspeed to use within this range. current CPU frequency is802MHz.

可以看到
driver: intel_pstate
available cpufreq governors: performance, powersave

禁用intel_pstate:

修改 /etc/default/grub中GRUB_CMDLINE_LINUX_DEFAULT内容
原始内容: GRUB_CMDLINE_LINUX_DEFAULT=“quietsplash”
更改后的内容:GRUB_CMDLINE_LINUX_DEFAULT=“quietsplash intel_pstate=disable”
更新grub :sudo update-grub
重启机器

设置cpu固定频率

sudo cpufreq-set -g userspace
sudo cpupower frequency-set -f 2.0GHz

查看cpu频率

cat /proc/cpuinfo | grep MH

设置CPU Performance模式

# cpupower设置performancecpupower frequency-set-gperformance# 查看当前的调节器cat/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor performance
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/9/8 21:13:12

1929-2024年全球气象站点年平均降水数据

气象数据是各项研究中都经常使用的基础数据,气象指标包括气温、风速、降水、湿度等。其中,降水数据在水文预报、农业生产、生态保护等领域具有广泛的应用价值。准确的降水数据对于水资源管理、农业生产、评估水文气象风险等至关重要。随着全球气候变暖&a…

作者头像 李华
网站建设 2026/9/8 21:12:21

三步跑通:pdf-inspector PDF 文本提取与智能类型检测快速指南

三步跑通:pdf-inspector PDF 文本提取与智能类型检测快速指南 【免费下载链接】pdf-inspector Fast Rust library for PDF inspection, classification, and text extraction. Intelligently detects scanned vs text-based PDFs to enable smart routing decisions…

作者头像 李华
网站建设 2026/9/8 21:11:49

CMSIS-FreeRTOS源码深度解析:ARM Cortex-M嵌入式RTOS架构与静态审计

1. 项目概述:这不是一次简单的“代码浏览”,而是一场面向嵌入式系统工程师的源码级实战推演 CMSIS-FreeRTOS 这个名字在 ARM 生态里出现频率极高,但绝大多数人只把它当作 Keil MDK 工程模板里一个自动勾选的复选框,或者 CubeMX 生…

作者头像 李华
网站建设 2026/9/8 21:11:34

Rust/codex-rs

Rust/codex-rs 【免费下载链接】openinterpreter A coding agent for open models like Kimi K3 and GLM 5.3 项目地址: https://gitcode.com/GitHub_Trending/op/openinterpreter In the codex-rs folder where the rust code lives: Crate names are prefixed with c…

作者头像 李华
网站建设 2026/9/8 21:11:26

螺旋矩阵(蜗牛排序)全解:两种解法与边界条件详解

刷 LeetCode 的时候,经常能看到一类让初学者又爱又恨的题目:明明逻辑不复杂,代码一写就出错,边界条件绕得人头晕。“蜗牛排序”就是其中最有代表性的一个,它的正式名字叫螺旋矩阵(Spiral Matrix&#xff09…

作者头像 李华