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

Coywolf Qi Hunt
2005-05-17T03:01:33Z

On 5/17/05, Christoph Lameter <christoph@lameter.com> wrote:
> On Mon, 16 May 2005, Andrew Morton wrote:
>
> > So yes, the time has come around again to work out what we're going to do
> > about this. I'd be a bit worried about allowing users to set HZ=724,
> > simply because nobody tests with that, and it might expose odd timing
> > relationships and unfortunate arithmetic rounding artifacts. So if we're
> > going to do this thing it might be better to just offer 100, 250 and 1000.
>
> Ok. Here is the patch allowing 100, 250 and 1000 HZ for i386 and x86_64:
>
> -----
>
> Make the timer frequency selectable. The timer interrupt may cause bus
> and memory contention in large NUMA systems since the interrupt occurs
> on each processor HZ times per second.
>
> Signed-off-by: Christoph Lameter <christoph@lameter.com>
> Signed-off-by: Shai Fultheim <shai@scalex86.org>
>
> Index: linux-2.6.12-rc4/arch/i386/Kconfig
> ===================================================================
> --- linux-2.6.12-rc4.orig/arch/i386/Kconfig 2005-05-17 02:19:55.000000000 +0000
> +++ linux-2.6.12-rc4/arch/i386/Kconfig 2005-05-17 02:27:12.000000000 +0000
> @@ -1133,6 +1133,20 @@
> a work-around for a number of buggy BIOSes. Switch this option on if
> your computer crashes instead of powering off properly.
>
> +config HZ
> + int "Frequency of the Timer Interrupt (100, 250 or 1000 per second)"
> + range 100 1000
> + default 1000
> + help
> + Allows the configuration of the timer frequency. It is customary
> + to have the timer interrupt run at 1000 HZ but 100 HZ may be more
> + beneficial for servers and NUMA systems that do not need to have
> + a fast response for user interaction and that may experience bus
> + contention and cacheline bounces as a result of timer interrupts.
> + Note that the timer interrupt occurs on each processor in an SMP
> + environment leading to NR_CPUS * HZ number of timer interrupts
> + per second.
> +
> endmenu
>
> source "arch/i386/kernel/cpu/cpufreq/Kconfig"
> Index: linux-2.6.12-rc4/include/asm-i386/param.h
> ===================================================================
> --- linux-2.6.12-rc4.orig/include/asm-i386/param.h 2005-05-17 02:15:57.000000000 +0000
> +++ linux-2.6.12-rc4/include/asm-i386/param.h 2005-05-17 02:30:22.000000000 +0000
> @@ -1,8 +1,19 @@
> +#include <linux/config.h>
> +
> #ifndef _ASMi386_PARAM_H
> #define _ASMi386_PARAM_H
>
> #ifdef __KERNEL__
> -# define HZ 1000 /* Internal kernel timer frequency */
> +#if CONFIG_HZ == 1000
> +#define HZ 1000 /* Internal kernel timer frequency */
> +#elif CONFIG_HZ == 250
> +#define CONFIG_HZ 250

You mean #define HZ 250 here.
--
Coywolf Qi Hunt