I was asked to introduce probes in malloc to aid in debugging cases in
which our memory allocation code performs poorly.
I've grouped the probes in separate patches, in which the probes are
logically connected. I'd appreciate feedback on the soundness of the
probe set: did I miss anything in these groups that is worth probing?
is any of the probes uselessly redundant? are they desirable at all?
Are they ok for master? Do the docs look reasonable, description and
formatting-wise? (The only other probe docs I found in glibc were in
elf/rtld-debugger-interface.txt)
The version of the patchset I pushed to lxoliva/malloc-probes-bz742038
depends on Siddhesh's patch that introduces get_another_arena. Although
I've just suggested changes to it, I decided to post the patchset as it
is, since most of it applies cleanly anyway, and regardless of
adjustments needed for Siddhesh's patch, I suspect we might go through
more than one round of review before my patchset can go in anyway.
04-malloc-probes.patch
Add first set of malloc probes.
From: Alexandre Oliva<aoliva@redhat.com>
for ChangeLog
from Alexandre Oliva<aoliva@redhat.com>
* malloc/malloc.c: Include stap-probe.h.
(__libc_mallopt): Add mallopt probe.
* malloc/arena.c (_int_new_arena): Add malloc_arena_new probe.
* manual/malloc.texi: Document them.
section Statistics for Memory Allocation with @code{malloc}
06-malloc-probe-arena-changes.patch
Add probes for malloc arena changes.
From: Alexandre Oliva<aoliva@redhat.com>
for ChangeLog
from Alexandre Oliva<aoliva@redhat.com>
* malloc/arena.c (get_free_list): Add probe
malloc_arena_reuse_free_list.
(reused_arena) [PER_THREAD]: Add probes malloc_arena_reuse_wait
and malloc_arena_reuse.
(arena_get2) [!PER_THREAD]: Likewise.
* malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
malloc_arena_reuse_realloc.
* manual/malloc.texi: Document them.
07-malloc-probe-retries.patch
Add probes for malloc retries.
From: Alexandre Oliva<aoliva@redhat.com>
for ChangeLog
from Alexandre Oliva<aoliva@redhat.com>
* malloc/malloc.c (__libc_malloc): Add malloc_retry probe.
(__libc_realloc): Add realloc_retry probe.
(__libc_memalign): Add memalign_retry probe.
(__libc_valloc): Add valloc_retry probe.
(__libc_pvalloc): Add pvalloc_retry probe.
(__libc_calloc): Add calloc_retry probe.
* manual/malloc.texi: Document them.
09-malloc-probe-heaps.patch
Add malloc probes for sbrk and heap resizing.
From: Alexandre Oliva<aoliva@redhat.com>
for ChangeLog
from Alexandre Oliva<aoliva@redhat.com>
* malloc/arena.c (new_heap): New heap_new probe.
(grow_heap): New heap_more probe.
(shrink_heap): New heap_less probe.
(heap_trim): New heap_free probe.
* malloc/malloc.c (sysmalloc): New sbrk_more probe.
(systrim): New sbrk_less probe.
* manual/malloc.texi: Document them.