From af2f859dcf54fe10c3d7dcd08e305bed310d9bc9 Mon Sep 17 00:00:00 2001 From: David Mosberger Date: Wed, 24 Mar 2004 19:53:10 -0800 Subject: [PATCH] ia64: Improve layout of cpuinfo_ia64 Stephane made some measurements on the access-pattern of the cpuinfo_ia64 members and based on those results, this patch reorganizes the structure for better cache-line sharing. --- arch/ia64/kernel/smp.c | 14 -------------- arch/ia64/kernel/smpboot.c | 2 -- arch/ia64/kernel/time.c | 32 +++++++++++++++++++------------- include/asm-ia64/processor.h | 32 ++++++++++++++++---------------- 4 files changed, 35 insertions(+), 45 deletions(-) diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c index 72f59bb837413..7f56a498664d7 100644 --- a/arch/ia64/kernel/smp.c +++ b/arch/ia64/kernel/smp.c @@ -91,9 +91,6 @@ handle_IPI (int irq, void *dev_id, struct pt_regs *regs) unsigned long *pending_ipis = &__ia64_per_cpu_var(ipi_operation); unsigned long ops; - /* Count this now; we may make a call that never returns. */ - local_cpu_data->ipi_count++; - mb(); /* Order interrupt and bit testing. */ while ((ops = xchg(pending_ipis, 0)) != 0) { mb(); /* Order bit clearing and data access. */ @@ -338,17 +335,6 @@ smp_call_function (void (*func) (void *info), void *info, int nonatomic, int wai } EXPORT_SYMBOL(smp_call_function); -void -smp_do_timer (struct pt_regs *regs) -{ - int user = user_mode(regs); - - if (--local_cpu_data->prof_counter <= 0) { - local_cpu_data->prof_counter = local_cpu_data->prof_multiplier; - update_process_times(user); - } -} - /* * this function calls the 'stop' function on all other CPUs in the system. */ diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c index a2d9831faf75e..1db117af80a95 100644 --- a/arch/ia64/kernel/smpboot.c +++ b/arch/ia64/kernel/smpboot.c @@ -265,8 +265,6 @@ ia64_sync_itc (unsigned int master) static inline void __init smp_setup_percpu_timer (void) { - local_cpu_data->prof_counter = 1; - local_cpu_data->prof_multiplier = 1; } static void __init diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index acb30e46ed07a..744734ecb5625 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c @@ -255,9 +255,13 @@ timer_interrupt (int irq, void *dev_id, struct pt_regs *regs) ia64_do_profile(regs); while (1) { - #ifdef CONFIG_SMP - smp_do_timer(regs); + /* + * For UP, this is done in do_timer(). Weird, but + * fixing that would require updates to all + * platforms. + */ + update_process_times(user_mode(regs)); #endif new_itm += local_cpu_data->itm_delta; @@ -280,17 +284,19 @@ timer_interrupt (int irq, void *dev_id, struct pt_regs *regs) } do { - /* - * If we're too close to the next clock tick for comfort, we increase the - * safety margin by intentionally dropping the next tick(s). We do NOT update - * itm.next because that would force us to call do_timer() which in turn would - * let our clock run too fast (with the potentially devastating effect of - * losing monotony of time). - */ - while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2)) - new_itm += local_cpu_data->itm_delta; - ia64_set_itm(new_itm); - /* double check, in case we got hit by a (slow) PMI: */ + /* + * If we're too close to the next clock tick for + * comfort, we increase the safety margin by + * intentionally dropping the next tick(s). We do NOT + * update itm.next because that would force us to call + * do_timer() which in turn would let our clock run + * too fast (with the potentially devastating effect + * of losing monotony of time). + */ + while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2)) + new_itm += local_cpu_data->itm_delta; + ia64_set_itm(new_itm); + /* double check, in case we got hit by a (slow) PMI: */ } while (time_after_eq(ia64_get_itc(), new_itm)); return IRQ_HANDLED; } diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index 0d8d6d5a67577..5ff52c4eeb727 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h @@ -148,35 +148,35 @@ struct cpuinfo_ia64 { __u32 softirq_pending; __u64 itm_delta; /* # of clock cycles between clock ticks */ __u64 itm_next; /* interval timer mask value to use for next clock tick */ + __u64 nsec_per_cyc; /* (1000000000<