public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Performance analysis of i386 SMP timer interrupt
@ 2004-12-04 19:51 Chuck Ebbert
  0 siblings, 0 replies; only message in thread
From: Chuck Ebbert @ 2004-12-04 19:51 UTC (permalink / raw)
  To: linux-kernel

Performance analysis of arch/i386/kernel/apic.c::smp_local_timer_interrupt:

{
        int cpu = smp_processor_id();

        profile_tick(CPU_PROFILING, regs);
1 ->    if (--per_cpu(prof_counter, cpu) <= 0) {

                per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
2 ->            if (per_cpu(prof_counter, cpu) !=
                                        per_cpu(prof_old_multiplier, cpu)) {
3 ->                    __setup_APIC_LVTT(
                                        calibration_result/
                                        per_cpu(prof_counter, cpu));
4 ->                    per_cpu(prof_old_multiplier, cpu) =
                                                per_cpu(prof_counter, cpu);
                }

5 ->            update_process_times(user_mode(regs));
        }
}


(1)     Needs likely().

(2)     Needs unlikely().

(3,4)   (4) should be done before (3) to minimize register usage.
        (function becomes 6 insns smaller and uses 8 bytes less stack space)

(5)     The user_mode() macro is inefficient:
        #define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs))

        (VM86 mode is very rare compared to normal cpu mode, so both
        parts of the 'or' are evaluated almost every time on most systems.)


--Chuck Ebbert  04-Dec-04  14:50:39

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-12-04 19:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-04 19:51 Performance analysis of i386 SMP timer interrupt Chuck Ebbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox