--- //depot/vendor/freebsd/src/sys/amd64/amd64/local_apic.c 2007/05/08 22:07:24 +++ //depot/user/jhb/acpipci/amd64/amd64/local_apic.c 2007/06/07 14:39:59 @@ -72,8 +72,6 @@ CTASSERT(IPI_STOP < APIC_SPURIOUS_INT); #define LAPIC_TIMER_HZ_DIVIDER 2 -#define LAPIC_TIMER_STATHZ_DIVIDER 15 -#define LAPIC_TIMER_PROFHZ_DIVIDER 3 /* Magic IRQ values for the timer and syscalls. */ #define IRQ_TIMER (NUM_IO_INTS + 1) @@ -383,13 +381,24 @@ lapic_timer_divisor, value); /* - * We will drive the timer at a small multiple of hz and drive - * both of the other timers with similarly small but relatively - * prime divisors. + * We want to run stathz in the neighborhood of 128hz. We would + * like profhz to run as often as possible, so we let it run on + * each clock tick. We try to honor the requested 'hz' value as + * much as possible. + * + * If 'hz' is above 1500, then we just let the lapic timer + * (and profhz) run at hz. If 'hz' is below 1500 but above + * 750, then we let the lapic timer run at 2 * 'hz'. If 'hz' + * is below 750 then we let the lapic timer run at 4 * 'hz'. */ - lapic_timer_hz = hz * LAPIC_TIMER_HZ_DIVIDER; - stathz = lapic_timer_hz / LAPIC_TIMER_STATHZ_DIVIDER; - profhz = lapic_timer_hz / LAPIC_TIMER_PROFHZ_DIVIDER; + if (hz >= 1500) + lapic_timer_hz = hz; + else if (hz >= 750) + lapic_timer_hz = hz * 2; + else + lapic_timer_hz = hz * 4; + stathz = lapic_timer_hz / (lapic_timer_hz / 128); + profhz = lapic_timer_hz; lapic_timer_period = value / lapic_timer_hz; /* --- //depot/vendor/freebsd/src/sys/i386/i386/local_apic.c 2007/05/08 22:03:14 +++ //depot/user/jhb/acpipci/i386/i386/local_apic.c 2007/06/07 14:39:59 @@ -72,8 +72,6 @@ CTASSERT(IPI_STOP < APIC_SPURIOUS_INT); #define LAPIC_TIMER_HZ_DIVIDER 2 -#define LAPIC_TIMER_STATHZ_DIVIDER 15 -#define LAPIC_TIMER_PROFHZ_DIVIDER 3 /* Magic IRQ values for the timer and syscalls. */ #define IRQ_TIMER (NUM_IO_INTS + 1) @@ -385,13 +383,24 @@ lapic_timer_divisor, value); /* - * We will drive the timer at a small multiple of hz and drive - * both of the other timers with similarly small but relatively - * prime divisors. + * We want to run stathz in the neighborhood of 128hz. We would + * like profhz to run as often as possible, so we let it run on + * each clock tick. We try to honor the requested 'hz' value as + * much as possible. + * + * If 'hz' is above 1500, then we just let the lapic timer + * (and profhz) run at hz. If 'hz' is below 1500 but above + * 750, then we let the lapic timer run at 2 * 'hz'. If 'hz' + * is below 750 then we let the lapic timer run at 4 * 'hz'. */ - lapic_timer_hz = hz * LAPIC_TIMER_HZ_DIVIDER; - stathz = lapic_timer_hz / LAPIC_TIMER_STATHZ_DIVIDER; - profhz = lapic_timer_hz / LAPIC_TIMER_PROFHZ_DIVIDER; + if (hz >= 1500) + lapic_timer_hz = hz; + else if (hz >= 750) + lapic_timer_hz = hz * 2; + else + lapic_timer_hz = hz * 4; + stathz = lapic_timer_hz / (lapic_timer_hz / 128); + profhz = lapic_timer_hz; lapic_timer_period = value / lapic_timer_hz; /*