From: Chuck Ebbert <76306.1226@compuserve.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Subject: [patch 2.6.15] i386: Optimize local APIC timer interrupt code
Date: Wed, 4 Jan 2006 13:48:09 -0500 [thread overview]
Message-ID: <200601041352_MC3-1-B550-4606@compuserve.com> (raw)
Local APIC timer interrupt happens HZ times per second on each CPU.
Optimize it for the case where profile multiplier equals one and does
not change (99+% of cases); this saves about 20 CPU cycles on Pentium II.
Also update the old multiplier immediately after noticing it changed,
while values are register-hot, saving eight bytes of stack depth.
Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
diff -up 2.6.15a.orig/arch/i386/kernel/apic.c 2.6.15a/arch/i386/kernel/apic.c
--- 2.6.15a.orig/arch/i386/kernel/apic.c
+++ 2.6.15a/arch/i386/kernel/apic.c
@@ -1137,7 +1137,7 @@ inline void smp_local_timer_interrupt(st
int cpu = smp_processor_id();
profile_tick(CPU_PROFILING, regs);
- if (--per_cpu(prof_counter, cpu) <= 0) {
+ if (likely(--per_cpu(prof_counter, cpu)) <= 0) {
/*
* The multiplier may have changed since the last time we got
* to this point as a result of the user writing to
@@ -1147,13 +1147,13 @@ inline void smp_local_timer_interrupt(st
* Interrupts are already masked off at this point.
*/
per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
- if (per_cpu(prof_counter, cpu) !=
- per_cpu(prof_old_multiplier, cpu)) {
+ if (unlikely(per_cpu(prof_counter, cpu) !=
+ per_cpu(prof_old_multiplier, cpu))) {
+ per_cpu(prof_old_multiplier, cpu) =
+ per_cpu(prof_counter, cpu);
__setup_APIC_LVTT(
calibration_result/
per_cpu(prof_counter, cpu));
- per_cpu(prof_old_multiplier, cpu) =
- per_cpu(prof_counter, cpu);
}
#ifdef CONFIG_SMP
--
Chuck
next reply other threads:[~2006-01-04 18:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-04 18:48 Chuck Ebbert [this message]
2006-01-04 23:01 ` [patch 2.6.15] i386: Optimize local APIC timer interrupt code Andrew Morton
2006-01-05 6:03 ` Willy Tarreau
-- strict thread matches above, loose matches on Subject: below --
2006-01-05 0:17 Chuck Ebbert
2006-01-05 6:38 Chuck Ebbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200601041352_MC3-1-B550-4606@compuserve.com \
--to=76306.1226@compuserve.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox