修改linux内核定时器
我必须运行延迟敏感的应用程序,并且被要求将计时器分辨率更改为 1000 Hz 或更高。我在网上搜索了一下,找到了有关 CONFIG_HZ 等的页面。
但是,文件中似乎还有其他几个相关设置,所以我想确保我不会弄乱设置。我在这里发布一些输出
$cat /boot/config-2.6.28-11-generic | grep HZ
# CONFIG_HZ_1000 is not set
# CONFIG_HZ_300 is not set
CONFIG_MACHZ_WDT=m
CONFIG_NO_HZ=y
CONFIG_HZ=250
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
那么第二行“# CONFIG_HZ_1000 is not set”是否意味着不支持 1000Hz?我是否必须只更改 CONFIG_HZ 而不是 CONFIG_HZ-250?
PS:我在 Geode 处理器上使用 2.6 内核(ubuntu jaunty)。
编辑1:我从 http://www.advenage.com/ 运行了一些代码topic/linux-timer-interrupt-Frequency.php 在我的台式机和开发机上。据推测,该代码可以准确衡量系统可以维持计时器的速度。输出约为 183 Hz(在开发机器上)。那么改变定时器有意义吗?
I have to run a latency sensitive application and I have been asked to change the timer resolution to 1000 Hz or more. I searched on the net a bit and found pages about CONFIG_HZ etc.
However, there are what seem to be several other related settings in the file as well, so I want to be sure that I don't mess the settings up. I am posting some output here
$cat /boot/config-2.6.28-11-generic | grep HZ
# CONFIG_HZ_1000 is not set
# CONFIG_HZ_300 is not set
CONFIG_MACHZ_WDT=m
CONFIG_NO_HZ=y
CONFIG_HZ=250
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
So does the second line, "# CONFIG_HZ_1000 is not set", mean that 1000Hz is not supported? Do I have to change just CONFIG_HZ and not CONFIG_HZ-250?
PS: I'm using the 2.6 kernel (ubuntu jaunty) on a Geode processor.
EDIT1: I ran some code from http://www.advenage.com/topics/linux-timer-interrupt-frequency.php on my desktop machine and the development machine. The code supposedly is an accurate measure of how fast a timer the system can sustain. The output was approximately 183 Hz (on the development machine). So will changing the timer be meaningful?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不要直接编辑
.config
,除非您是 Kbuild 专家(如果您问这个问题,说明您不是 Kbuild 专家)。而是运行make menuconfig
或make xconfig
来加载基于菜单的配置系统。或者,make config
将执行基于行的配置过程(其中它会询问您数百个有关配置内容的问题 - 不推荐)。相关选项位于“处理器类型和功能”下的“定时器频率”。也就是说,这可能没有必要。现代 Linux 可以使用高分辨率事件计时器 (
CONFIG_HIGH_RES_TIMERS
) 来实现低延迟计时器,甚至无需增加计时器频率。对于无滴答系统 (CONFIG_NO_HZ
),计时器频率几乎没有影响。另一方面,我不确定 Geode CPU 有哪些定时器支持。您可能需要使用各种内核配置运行 cyclictest 来查看您需要获得什么低延迟性能。您运行的测试测试的是最大调度频率,而不是调度延迟,因此与循环测试结果进行比较会很有趣。如果您需要真正低延迟,CONFIG_PREEMPT_RT 补丁集可能也会感兴趣。
Don't edit
.config
directly, unless you're a Kbuild expert (and if you're asking this, you're not a Kbuild expert). Instead runmake menuconfig
ormake xconfig
to load the menu-based configuration system. Alternately,make config
will do a line-based configuration process (where it asks you several hundred questions about what to configure - not recommended). The relevant option is under "Processor type and features" as "Timer frequency".That said, this may not be necessary. Modern Linux can use high-resolution event timers (
CONFIG_HIGH_RES_TIMERS
) to acheive low-latency timers even without increasing the timer frequency. With a tickless system (CONFIG_NO_HZ
) , the timer frequency has little effect at all.On the other hand, I'm not sure what timer support Geode CPUs have. You may want to run cyclictest with various kernel configurations to see what you need to get low latency performance. The test you ran tests maximum dispatch frequency, not dispatch latency, so comparing with cyclictest results would be interesting. If you need really low latency, the CONFIG_PREEMPT_RT patchset may also be of interest.
要更改计时器设置,您需要重新编译内核。更改某些标准菜单配置工具中的选项,而不是文本文件。
/boot/config...
文件仅告诉您特定内核二进制文件中安装的内容。这不是您可以更改的配置文件。To change the timer setting you need to recompile the kernel. Change the option in some standard menu configuration tool, rather than the text file.
/boot/config...
files only tell you what is installed in the specific kernel binary. This is not a configuration file you can change.当配置选项不可用时,它只是不存在于
.config
文件中。例如,这些内核选项:
可供您设置。
要设置它们,最安全的方法是使用基于菜单的界面,例如
make menuconfig
。在 menuconfig 中,要查找给定内核配置参数的位置,请键入
/
打开搜索框。When a config option is not available it's just not present in the
.config
file.For instance, those kernel options:
are available for you to set.
To set them, the safest is to use a menu based interface like
make menuconfig
.In menuconfig, to find out the location of a given kernel config parameter, type
/
to open the search box.