2009-04-27 23:07:26

by Alok Kataria

[permalink] [raw]
Subject: Default HZ value for X86

Hi,

I was wondering why do we still have the default HZ value as 1000 for
the x86 kernels.

arch/x86/configs/i386_defconfig:CONFIG_HZ=1000
arch/x86/configs/x86_64_defconfig:CONFIG_HZ=1000

With the highres timer implementation it was planned to move away from
relying on high timer interrupt frequency for applications requiring
precise high resolution timer's.

This quote in the timer/hrtimers.txt also mentions that we should be
able to decrease the frequency of the timeout subsystem, which I assume
would mean reducing HZ value.

---------------------------------------------------------------------
"Another potential benefit is that such a separation allows even more
special-purpose optimization of the existing timer wheel for the low
resolution and low precision use cases - once the precision-sensitive
APIs are separated from the timer wheel and are migrated over to
hrtimers. E.g. we could decrease the frequency of the timeout subsystem
from 250 Hz to 100 HZ (or even smaller)."
---------------------------------------------------------------------

So, are there still any concerns that keep us from lowering the default
HZ value down to 250/100 for mainline ?

Thanks,
Alok


2009-04-27 23:35:21

by Alan

[permalink] [raw]
Subject: Re: Default HZ value for X86

On Mon, 27 Apr 2009 16:07:10 -0700
Alok Kataria <[email protected]> wrote:

> Hi,
>
> I was wondering why do we still have the default HZ value as 1000 for
> the x86 kernels.
>
> arch/x86/configs/i386_defconfig:CONFIG_HZ=1000
> arch/x86/configs/x86_64_defconfig:CONFIG_HZ=1000
>
> With the highres timer implementation it was planned to move away from
> relying on high timer interrupt frequency for applications requiring
> precise high resolution timers.

With the tickless kernel does this really matter any more ? We might as
well keep a logical 1000 for convenience and accuracy.

Alan

2009-04-28 16:55:56

by Alok Kataria

[permalink] [raw]
Subject: Re: Default HZ value for X86


On Mon, 2009-04-27 at 16:34 -0700, Alan Cox wrote:
> On Mon, 27 Apr 2009 16:07:10 -0700
> Alok Kataria <[email protected]> wrote:
>
> > Hi,
> >
> > I was wondering why do we still have the default HZ value as 1000 for
> > the x86 kernels.
> >
> > arch/x86/configs/i386_defconfig:CONFIG_HZ=1000
> > arch/x86/configs/x86_64_defconfig:CONFIG_HZ=1000
> >
> > With the highres timer implementation it was planned to move away from
> > relying on high timer interrupt frequency for applications requiring
> > precise high resolution timers.
>
> With the tickless kernel does this really matter any more ?

Agreed that with tickless it won't be an issue anymore when the system
is idle, but when the system is loaded the interrupts will still fire at
HZ frequency.
I ran a simple tight loop to check what kind of effect would the HZ
value have on system performance. This tight loop was run on a 2.6.29
kernel running under VMware looping till count of 6X10^9.
The one with HZ = 1000 took about 4m 24s, (264sec)
Total timer interrupts = 264405

And the one with HZ = 100 took about 4m 15s (255sec)
Total timer interrupts = 25593.

Please note that the system was booted in a single user mode and only
the minimal services were running to reduce any interference from any
other process. These numbers are averaged across 3 runs.

The cost of servicing an interrupt would be a little higher in the
virtualized environment, so I am not sure if it would have a similar
impact on a real hardware.
So this mail is more to understand if there could be any real downsides
with reducing the Hz value, FWIU it shouldn't affect the correctness of
the system right ?

> We might as
> well keep a logical 1000 for convenience and accuracy.

What is the accuracy factor that you are mentioning here ? i guess you
mean the precision of the timeouts, but that shouldn't matter much
right ?

Thanks,
Alok
>
> Alan

2009-04-30 17:52:21

by Artur Skawina

[permalink] [raw]
Subject: Re: Default HZ value for X86

Alan Cox wrote:
> On Mon, 27 Apr 2009 16:07:10 -0700
> Alok Kataria <[email protected]> wrote:
>>
>> I was wondering why do we still have the default HZ value as 1000 for
>> the x86 kernels.
>>
>> arch/x86/configs/i386_defconfig:CONFIG_HZ=1000
>> arch/x86/configs/x86_64_defconfig:CONFIG_HZ=1000
>>
>> With the highres timer implementation it was planned to move away from
>> relying on high timer interrupt frequency for applications requiring
>> precise high resolution timers.
>
> With the tickless kernel does this really matter any more ? We might as

It didn't matter much, until the kernel stopped actually being tickless.
These days, w/ ints on when nonidle, it probably does again...

> well keep a logical 1000 for convenience and accuracy.

2009-04-30 18:24:33

by Alok Kataria

[permalink] [raw]
Subject: Re: Default HZ value for X86


On Mon, 2009-04-27 at 16:07 -0700, Alok Kataria wrote:
> Hi,
>
> I was wondering why do we still have the default HZ value as 1000 for
> the x86 kernels.
>
> arch/x86/configs/i386_defconfig:CONFIG_HZ=1000
> arch/x86/configs/x86_64_defconfig:CONFIG_HZ=1000
>
Ingo/Thomas,

I noticed that the default HZ value was switched back to 1000 (from 250)
about an year back. The commit log didn't have any details about the
switch, and I was wondering what prompted that change ?

-------------------------------------------------------------------------
commit 5cb04df8d3f03e37a19f2502591a84156be71772
x86: defconfig updates

refresh 32-bit defconfig too, and update the 64-bit configs as well,
the defconfig should be much more useful by default, so most of the
updates are the enabling of various options.
-------------------------------------------------------------------------

Thanks,
Alok