Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt.

Linus Torvalds
2005-05-17T03:35:25Z

On Mon, 16 May 2005, Christoph Lameter wrote:
>
> That would not allow to set the value of CONFIG_HZ to a numeric value.
> I would have CONFIG_HZ_100 CONFIG_HZ_250 etc. Gets a bit complicated
> to handle.

I don't think it gets any more complex to handle than the stuff you need
to do now (#ifdef's, and the #define HZ CONFIG_HZ games).

Also, I think you can do it in the Kconfig file, which at least makes it a
fairly localized thing:

choice
prompt "Timer frequency"
default HZ_250

config HZ_100
bool "100 Hz"

confic HZ_250
bool "250 Hz"

config HZ_1000
bool "1000 Hz"

endchoice

config HZ
int
default 100 if HZ_100
default 250 if HZ_250
default 1000 if HZ_1000

and now you can just do

#define HZ CONFIG_HZ

or something. You can even maje the Kconfig parts be a separate Kconfig.HZ
file, and have both the x86 and x86-64 Kconfig files just include the
common part (since it's a generic issue, not even PC-related: we might
want to allow things like 60Hz frequencies for CONFIG_EMBEDDED etc, and
these choices are really valid on any system that allows for the timer to
be reprogrammed)

The above is obviously totally untested, but it doesn't look any more
complex than having a fairly ugly (and much less user-friendly) check at
compile-time.

Linus