From d19788990f704f17dcb219a13131c71a70215a9d Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 2 Mar 2005 14:17:43 +0000 Subject: [PATCH] Tweak the lapic timer code to get the performance closer to the pre-lapic timer case: - Remove the virtual fooclock interrupt counters as they have served their purpose. - Adjust the dividers for the different clock such that profhz is now a multiple of stathz as in the non-lapic case, and the timer now runs at hz * 2 rather than hz * 3. With the new divisors, the default clock rates are: kern.clockrate: { hz = 1000, tick = 1000, profhz = 666, stathz = 133 } --- sys/i386/i386/local_apic.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/sys/i386/i386/local_apic.c b/sys/i386/i386/local_apic.c index debb691f96e8..307764e35acd 100644 --- a/sys/i386/i386/local_apic.c +++ b/sys/i386/i386/local_apic.c @@ -66,9 +66,9 @@ CTASSERT(APIC_TIMER_INT < APIC_LOCAL_INTS); CTASSERT(APIC_LOCAL_INTS == 240); CTASSERT(IPI_STOP < APIC_SPURIOUS_INT); -#define LAPIC_TIMER_HZ_DIVIDER 3 -#define LAPIC_TIMER_STATHZ_DIVIDER 23 -#define LAPIC_TIMER_PROFHZ_DIVIDER 2 +#define LAPIC_TIMER_HZ_DIVIDER 2 +#define LAPIC_TIMER_STATHZ_DIVIDER 15 +#define LAPIC_TIMER_PROFHZ_DIVIDER 3 /* * Support for local APICs. Local APICs manage interrupts on each @@ -130,8 +130,6 @@ static u_int32_t lapic_timer_divisors[] = { volatile lapic_t *lapic; static u_long lapic_timer_divisor, lapic_timer_period, lapic_timer_hz; -static u_long *lapic_virtual_hardclock, *lapic_virtual_statclock, - *lapic_virtual_profclock; static void lapic_enable(void); static void lapic_timer_enable_intr(void); @@ -372,9 +370,6 @@ lapic_setup_clock(void) stathz = lapic_timer_hz / LAPIC_TIMER_STATHZ_DIVIDER; profhz = lapic_timer_hz / LAPIC_TIMER_PROFHZ_DIVIDER; lapic_timer_period = value / lapic_timer_hz; - intrcnt_add("lapic: hardclock", &lapic_virtual_hardclock); - intrcnt_add("lapic: statclock", &lapic_virtual_statclock); - intrcnt_add("lapic: profclock", &lapic_virtual_profclock); /* * Start up the timer on the BSP. The APs will kick off their @@ -628,10 +623,9 @@ lapic_handle_timer(struct clockframe frame) la->la_hard_ticks += hz; if (la->la_hard_ticks >= lapic_timer_hz) { la->la_hard_ticks -= lapic_timer_hz; - if (PCPU_GET(cpuid) == 0) { - (*lapic_virtual_hardclock)++; + if (PCPU_GET(cpuid) == 0) hardclock(&frame); - } else + else hardclock_process(&frame); } @@ -639,8 +633,6 @@ lapic_handle_timer(struct clockframe frame) la->la_stat_ticks += stathz; if (la->la_stat_ticks >= lapic_timer_hz) { la->la_stat_ticks -= lapic_timer_hz; - if (PCPU_GET(cpuid) == 0) - (*lapic_virtual_statclock)++; statclock(&frame); } @@ -648,8 +640,6 @@ lapic_handle_timer(struct clockframe frame) la->la_prof_ticks += profhz; if (la->la_prof_ticks >= lapic_timer_hz) { la->la_prof_ticks -= lapic_timer_hz; - if (PCPU_GET(cpuid) == 0) - (*lapic_virtual_profclock)++; if (profprocs != 0) profclock(&frame); }