This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 5/6] Add catch-all alloc retry probe.
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sourceware dot org
- Cc: carlos at redhat dot com, aj at suse dot com
- Date: Thu, 19 Sep 2013 12:10:33 -0300
- Subject: [PATCH 5/6] Add catch-all alloc retry probe.
- Authentication-results: sourceware.org; auth=none
- References: <523B05A1 dot 4060009 at redhat dot com>
for ChangeLog
* malloc/arena.c (arena_get_retry): Add memory_arena_retry probe.
* manual/probes.texi: Document it.
---
malloc/arena.c | 1 +
manual/probes.texi | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/malloc/arena.c b/malloc/arena.c
index 89e8b92..9ace186 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -932,6 +932,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
static mstate
arena_get_retry (mstate ar_ptr, size_t bytes)
{
+ LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
if(ar_ptr != &main_arena) {
(void)mutex_unlock(&ar_ptr->mutex);
ar_ptr = &main_arena;
diff --git a/manual/probes.texi b/manual/probes.texi
index f28f923..cb81011 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -44,6 +44,18 @@ two-argument functions, so that in all of these probes the
user-requested allocation size is in @var{$arg1}.
@end deftp
+@deftp Probe memory_arena_retry (size_t @var{$arg1}, void *@var{$arg2})
+This probe is hit within @code{arena_get_retry}, the function used by
+all of the corresponding functions above to select the alternate arena
+in which to retry the allocation, before the selection takes place.
+This probe is redundant, but much easier to use when it's not important
+to determine which memory allocation functions are failing to allocate
+in the first try. Argument @var{$arg1} is the same as in the
+function-specific probes, except for extra room for padding introduced
+by functions that have to ensure stricter alignment. Argument
+@var{$arg2} is the arena in which allocation failed.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is