* Ingo Molnar <[email protected]> wrote:
> * Ingo Molnar <[email protected]> wrote:
>
> > and have measured the overhead of an unmodified, kprobes-probed and
> > djprobes-probed sys_getpid() system-call:
> >
> > sys_getpid() unmodified latency: 317 cycles [ 0.146 usecs ]
> > sys_getpid() kprobes latency: 815 cycles [ 0.377 usecs ]
> > sys_getpid() djprobes latency: 380 cycles [ 0.176 usecs ]
>
> i have taken a look at the kprobes fastpath, and there are a few things
> we can do to speed it up. The patch below shaves off 75 cycles from the
> kprobes overhead:
>
> sys_getpid() kprobes-speedup: 740 cycles [ 0.342 usecs ]
>
> that reduces the kprobes overhead to 423 cycles.
the patch below brings the overhead down to 420 cycles:
sys_getpid() kprobes-speedup: 737 cycles [ 0.341 usecs ]
Ingo
---------->
Subject: [patch] kprobes: optimize branch placement
From: Ingo Molnar <[email protected]>
optimize gcc's code generation by hinting branch probabilities.
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/i386/kernel/kprobes.c | 2 +-
arch/i386/kernel/traps.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: linux/arch/i386/kernel/kprobes.c
===================================================================
--- linux.orig/arch/i386/kernel/kprobes.c
+++ linux/arch/i386/kernel/kprobes.c
@@ -220,7 +220,7 @@ int __kprobes kprobe_handler(struct pt_r
kcb = get_kprobe_ctlblk();
/* Check we're not actually recursing */
- if (kprobe_running()) {
+ if (unlikely(kprobe_running())) {
p = get_kprobe(addr);
if (p) {
if (kcb->kprobe_status == KPROBE_HIT_SS &&
Index: linux/arch/i386/kernel/traps.c
===================================================================
--- linux.orig/arch/i386/kernel/traps.c
+++ linux/arch/i386/kernel/traps.c
@@ -806,7 +806,7 @@ fastcall void __kprobes do_int3(struct p
* kernel-mode INT3s are likely kprobes:
*/
if (!user_mode(regs)) {
- if (kprobe_handler(regs))
+ if (likely(kprobe_handler(regs)))
return;
/* This is an interrupt gate, because kprobes wants interrupts
disabled. Normal trap handlers don't. */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]