linux-kernel-test/arch/arm/kernel
Srinivasa D S ef53d9c5e4 kprobes: improve kretprobe scalability with hashed locking
Currently list of kretprobe instances are stored in kretprobe object (as
used_instances,free_instances) and in kretprobe hash table.  We have one
global kretprobe lock to serialise the access to these lists.  This causes
only one kretprobe handler to execute at a time.  Hence affects system
performance, particularly on SMP systems and when return probe is set on
lot of functions (like on all systemcalls).

Solution proposed here gives fine-grain locks that performs better on SMP
system compared to present kretprobe implementation.

Solution:

 1) Instead of having one global lock to protect kretprobe instances
    present in kretprobe object and kretprobe hash table.  We will have
    two locks, one lock for protecting kretprobe hash table and another
    lock for kretporbe object.

 2) We hold lock present in kretprobe object while we modify kretprobe
    instance in kretprobe object and we hold per-hash-list lock while
    modifying kretprobe instances present in that hash list.  To prevent
    deadlock, we never grab a per-hash-list lock while holding a kretprobe
    lock.

 3) We can remove used_instances from struct kretprobe, as we can
    track used instances of kretprobe instances using kretprobe hash
    table.

Time duration for kernel compilation ("make -j 8") on a 8-way ppc64 system
with return probes set on all systemcalls looks like this.

cacheline              non-cacheline             Un-patched kernel
aligned patch 	       aligned patch
===============================================================================
real    9m46.784s       9m54.412s                  10m2.450s
user    40m5.715s       40m7.142s                  40m4.273s
sys     2m57.754s       2m58.583s                  3m17.430s
===========================================================

Time duration for kernel compilation ("make -j 8) on the same system, when
kernel is not probed.
=========================
real    9m26.389s
user    40m8.775s
sys     2m7.283s
=========================

Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>
Signed-off-by: Jim Keniston <jkenisto@us.ibm.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-25 10:53:30 -07:00
..
armksyms.c ftrace: store mcount address in rec->ip 2008-06-23 22:10:56 +02:00
arthur.c [ARM] arm/kernel/arthur.c: add MODULE_LICENSE 2008-05-17 22:55:16 +01:00
asm-offsets.c arm: use kbuild.h instead of macros in asm-offsets.c 2008-04-29 08:06:29 -07:00
atags.c clean up atags exporting code 2008-05-30 10:33:49 +02:00
atags.h [ARM] 4736/1: Export atags to userspace and allow kexec to use customised atags 2008-02-04 13:21:03 +00:00
bios32.c [ARM] 4577/1: ITE 8152 PCI bridge support 2007-10-15 18:53:59 +01:00
calls.S Merge branch 'omap2-upstream' into devel 2008-04-19 17:17:29 +01:00
compat.c
compat.h
crunch-bits.S
crunch.c [ARM] 4121/1: ep93xx: move setting of HWCAP_CRUNCH 2007-02-08 14:48:13 +00:00
debug.S
dma-isa.c [ARM] ARRAY_SIZE() cleanup 2008-01-26 14:49:57 +00:00
dma.c [ARM] Export dma_channel_active() 2007-03-31 21:36:53 +01:00
ecard.c arm: bus_id -> dev_name() and dev_set_name() conversions 2008-07-21 21:55:03 -07:00
ecard.h [ARM] rpc: ecard: remove deprecated ecard_address() and relatives 2008-07-03 14:25:58 +01:00
entry-armv.S Merge branches 'arm', 'at91', 'ep93xx', 'iop', 'ks8695', 'misc', 'mxc', 'ns9x', 'orion', 'pxa', 'sa1100', 's3c' and 'sparsemem' into devel 2008-04-19 17:17:25 +01:00
entry-common.S ftrace: store mcount address in rec->ip 2008-06-23 22:10:56 +02:00
entry-header.S
fiq.c
ftrace.c ftrace: store mcount address in rec->ip 2008-06-23 22:10:56 +02:00
head-common.S [ARM] 4881/1: print unrecognised processor ID as part of failure message 2008-04-19 11:28:08 +01:00
head-nommu.S [ARM] Ensure head text is always placed at the start of kernel 2007-05-08 15:15:45 +01:00
head.S [ARM] 4849/1: move ATAGS asm definitions 2008-03-06 12:18:18 +00:00
init_task.c [PATCH] take init_files to fs/file.c 2008-05-16 17:22:20 -04:00
io.c
irq.c [ARM] Remove needless linux/ptrace.h includes 2007-04-21 20:34:47 +01:00
isa.c [PATCH] sysctl: remove insert_at_head from register_sysctl 2007-02-14 08:09:59 -08:00
iwmmxt.S
kgdb.c kgdb: support for ARCH=arm 2008-07-23 11:30:15 -05:00
kprobes-decode.c kprobes/arm: fix decoding of arithmetic immediate instructions 2008-04-28 15:54:55 -04:00
kprobes.c kprobes: improve kretprobe scalability with hashed locking 2008-07-25 10:53:30 -07:00
machine_kexec.c [ARM] 4736/1: Export atags to userspace and allow kexec to use customised atags 2008-02-04 13:21:03 +00:00
Makefile kgdb: support for ARCH=arm 2008-07-23 11:30:15 -05:00
module.c PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
process.c Merge branch 'linus' into timers/nohz 2008-07-18 19:53:16 +02:00
ptrace.c Use helpers to obtain task pid in printks (arch code) 2007-10-19 11:53:43 -07:00
ptrace.h [ARM] ptrace: clean up single stepping support 2007-04-21 20:34:58 +01:00
relocate_kernel.S [ARM] 4736/1: Export atags to userspace and allow kexec to use customised atags 2008-02-04 13:21:03 +00:00
setup.c kgdb: support for ARCH=arm 2008-07-23 11:30:15 -05:00
signal.c [ARM] 4870/1: fix signal return code when enable CONFIG_OABI_COMPAT 2008-03-20 15:59:31 +00:00
signal.h
smp.c on_each_cpu(): kill unused 'retry' parameter 2008-06-26 11:24:38 +02:00
stacktrace.c Merge branch 'core/stacktrace' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-07-15 10:31:35 -07:00
stacktrace.h [ARM] Add stacktrace support and make oprofile use it 2007-04-28 09:59:37 +01:00
sys_arm.c unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
sys_oabi-compat.c [ARM] 4878/1: Add oabi shim for fstatat64 2008-03-28 15:00:46 +00:00
thumbee.c ARMv7: Add support for the ThumbEE state saving/restoring 2008-04-18 22:43:06 +01:00
time.c sysdev: Pass the attribute to the low level sysdev show/store function 2008-07-21 21:55:02 -07:00
traps.c kgdb: support for ARCH=arm 2008-07-23 11:30:15 -05:00
vmlinux.lds.S all archs: consolidate init and exit sections in vmlinux.lds.h 2008-01-28 23:21:17 +01:00
xscale-cp0.c [ARM] 3881/4: xscale: clean up cp0/cp1 handling 2006-12-03 17:52:22 +00:00