lkml.org 
[lkml]   [2004]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectPerformance analysis of i386 SMP timer interrupt
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.017 / U:0.928 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site