public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Ebbert <76306.1226@compuserve.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Performance analysis of i386 SMP timer interrupt
Date: Sat, 4 Dec 2004 14:51:31 -0500	[thread overview]
Message-ID: <200412041453_MC3-1-900E-1EAD@compuserve.com> (raw)

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

                 reply	other threads:[~2004-12-04 19:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200412041453_MC3-1-900E-1EAD@compuserve.com \
    --to=76306.1226@compuserve.com \
    --cc=linux-kernel@vger.kernel.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