How to change CONFIG_HZ parameter for Linux Kernel

If we want to change the tick time for Linux Kernel, we need to change CONFIG_HZ parameter in Linux Kernel. Do we have other better ways to change it rather than compiling Linux Kernel. Please ignore the way to add ‘divider=10’ in grub config file because it is limited only for RH/CentOS distros.

Zhiqiang, please answer this question if you know it. I cannot find the answer after Google for a long time. Thank you.

Answered by Eric Z Ma.

The HZ variable is extensively used as a macro, such as in
https://github.com/torvalds/linux/blob/e4fba88d00d21f50239eac7d653027bfaf844296/kernel/time/time.c#L277

This is likely for performance.

This may make it compile-time configurable only.


So it can only be changed by compiling a new Kernel.

Eric Z Ma

Eric is a father and systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *