简体   繁体   中英

Change linux kernel timer

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?

Don't edit .config directly, unless you're a Kbuild expert (and if you're asking this, you're not a Kbuild expert). Instead run make menuconfig or make 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.

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.

does the second line, # CONFIG_HZ_1000 is not set , mean that 1000Hz is not supported?

When a config option is not available it's just not present in the .config file.

For instance, those kernel options:

# CONFIG_HZ_1000 is not set
# CONFIG_HZ_300 is not set

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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