简体   繁体   English

如何在Linux中设置和锁定CPU频率

[英]How to set and lock cpu freq in linux

I am working under linux and what I want to do is to lock cpu to a certain frequency, disable cpu automatic freq change. 我在linux下工作,我想将cpu锁定到某个频率,禁用cpu自动频率更改。

Could anyone indicate how to do it in driver or kernel ? 谁能指出在驱动程序或内核中该如何做?

Thanks. 谢谢。

what I want to do is to lock cpu to a certain frequency, disable cpu automatic freq change. 我想做的是将cpu锁定到某个频率,禁用cpu自动频率更改。

You can use kernel modules to do this for you already and there are user space programs that you can run to disable it. 您可以使用内核模块为您执行此操作,并且可以运行一些用户空间程序来禁用它。 Look for Disable Frequency scaling. 查找“禁用频率缩放”。

on Debian the package can be installed as follows 在Debian上,可以如下安装软件包

aptitude install cpufrequtils

The read the docs from there. 从那里读取文档。 If you want to get a bit more hands by loading kernel modules, for Intel the one you need to load is... 如果您想通过加载内核模块来获得更多帮助,对于英特尔,您需要加载的模块是...

acpi-cpufreq

If you're running Linux in something like a VirtualBox and trying to load this it will likely fail because acpi will be disabled. 如果您在VirtualBox之类的系统中运行Linux并尝试加载该文件,则可能会失败,因为acpi将被禁用。 You can find out what you need to do here to control this from command line. 您可以在此处找到要从命令行控制它的操作。

http://www.thinkwiki.org/wiki/How_to_make_use_of_Dynamic_Frequency_Scaling http://www.thinkwiki.org/wiki/How_to_make_use_of_Dynamic_Frequency_Scaling

If you want to see how this is done in a kernel module the source code you need can be found here. 如果要查看如何在内核模块中完成此操作,则可以在此处找到所需的源代码。

http://lxr.free-electrons.com/source/drivers/cpufreq/acpi-cpufreq.c http://lxr.free-electrons.com/source/drivers/cpufreq/acpi-cpufreq.c

You would likely need to read the source for one of the governor modules to understand how this works. 您可能需要阅读其中一个调控器模块的源代码,以了解其工作原理。

If possible I'd control this from userspace. 如果可能的话,我会从用户空间控制它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM