mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Add probes for all changes to malloc options.
for ChangeLog * malloc/malloc.c (__libc_free): Add memory_mallopt_free_dyn_thresholds probe. (__libc_mallopt): Add multiple memory_mallopt probes. * manual/probes.texi: Document them.
This commit is contained in:
@ -1,5 +1,10 @@
|
|||||||
2013-09-20 Alexandre Oliva <aoliva@redhat.com>
|
2013-09-20 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
|
* malloc/malloc.c (__libc_free): Add
|
||||||
|
memory_mallopt_free_dyn_thresholds probe.
|
||||||
|
(__libc_mallopt): Add multiple memory_mallopt probes.
|
||||||
|
* manual/probes.texi: Document them.
|
||||||
|
|
||||||
* malloc/malloc.c: Include stap-probe.h.
|
* malloc/malloc.c: Include stap-probe.h.
|
||||||
(__libc_mallopt): Add memory_mallopt probe.
|
(__libc_mallopt): Add memory_mallopt probe.
|
||||||
* malloc/arena.c (_int_new_arena): Add memory_arena_new probe.
|
* malloc/arena.c (_int_new_arena): Add memory_arena_new probe.
|
||||||
|
@ -2896,6 +2896,8 @@ __libc_free(void* mem)
|
|||||||
{
|
{
|
||||||
mp_.mmap_threshold = chunksize (p);
|
mp_.mmap_threshold = chunksize (p);
|
||||||
mp_.trim_threshold = 2 * mp_.mmap_threshold;
|
mp_.trim_threshold = 2 * mp_.mmap_threshold;
|
||||||
|
LIBC_PROBE (memory_mallopt_free_dyn_thresholds, 2,
|
||||||
|
mp_.mmap_threshold, mp_.trim_threshold);
|
||||||
}
|
}
|
||||||
munmap_chunk(p);
|
munmap_chunk(p);
|
||||||
return;
|
return;
|
||||||
@ -4701,7 +4703,9 @@ int __libc_mallopt(int param_number, int value)
|
|||||||
|
|
||||||
switch(param_number) {
|
switch(param_number) {
|
||||||
case M_MXFAST:
|
case M_MXFAST:
|
||||||
if (value >= 0 && value <= MAX_FAST_SIZE) {
|
if (value >= 0 && value <= MAX_FAST_SIZE)
|
||||||
|
{
|
||||||
|
LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
|
||||||
set_max_fast(value);
|
set_max_fast(value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4709,11 +4713,15 @@ int __libc_mallopt(int param_number, int value)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case M_TRIM_THRESHOLD:
|
case M_TRIM_THRESHOLD:
|
||||||
|
LIBC_PROBE (memory_mallopt_trim_threshold, 3, value,
|
||||||
|
mp_.trim_threshold, mp_.no_dyn_threshold);
|
||||||
mp_.trim_threshold = value;
|
mp_.trim_threshold = value;
|
||||||
mp_.no_dyn_threshold = 1;
|
mp_.no_dyn_threshold = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_TOP_PAD:
|
case M_TOP_PAD:
|
||||||
|
LIBC_PROBE (memory_mallopt_top_pad, 3, value,
|
||||||
|
mp_.top_pad, mp_.no_dyn_threshold);
|
||||||
mp_.top_pad = value;
|
mp_.top_pad = value;
|
||||||
mp_.no_dyn_threshold = 1;
|
mp_.no_dyn_threshold = 1;
|
||||||
break;
|
break;
|
||||||
@ -4724,33 +4732,45 @@ int __libc_mallopt(int param_number, int value)
|
|||||||
res = 0;
|
res = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
LIBC_PROBE (memory_mallopt_mmap_threshold, 3, value,
|
||||||
|
mp_.mmap_threshold, mp_.no_dyn_threshold);
|
||||||
mp_.mmap_threshold = value;
|
mp_.mmap_threshold = value;
|
||||||
mp_.no_dyn_threshold = 1;
|
mp_.no_dyn_threshold = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_MMAP_MAX:
|
case M_MMAP_MAX:
|
||||||
|
LIBC_PROBE (memory_mallopt_mmap_max, 3, value,
|
||||||
|
mp_.n_mmaps_max, mp_.no_dyn_threshold);
|
||||||
mp_.n_mmaps_max = value;
|
mp_.n_mmaps_max = value;
|
||||||
mp_.no_dyn_threshold = 1;
|
mp_.no_dyn_threshold = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_CHECK_ACTION:
|
case M_CHECK_ACTION:
|
||||||
|
LIBC_PROBE (memory_mallopt_check_action, 2, value, check_action);
|
||||||
check_action = value;
|
check_action = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_PERTURB:
|
case M_PERTURB:
|
||||||
|
LIBC_PROBE (memory_mallopt_perturb, 2, value, perturb_byte);
|
||||||
perturb_byte = value;
|
perturb_byte = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef PER_THREAD
|
#ifdef PER_THREAD
|
||||||
case M_ARENA_TEST:
|
case M_ARENA_TEST:
|
||||||
if (value > 0)
|
if (value > 0)
|
||||||
|
{
|
||||||
|
LIBC_PROBE (memory_mallopt_arena_test, 2, value, mp_.arena_test);
|
||||||
mp_.arena_test = value;
|
mp_.arena_test = value;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_ARENA_MAX:
|
case M_ARENA_MAX:
|
||||||
if (value > 0)
|
if (value > 0)
|
||||||
|
{
|
||||||
|
LIBC_PROBE (memory_mallopt_arena_max, 2, value, mp_.arena_max);
|
||||||
mp_.arena_max = value;
|
mp_.arena_max = value;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,9 @@ arguments.
|
|||||||
@section Memory Allocation Probes
|
@section Memory Allocation Probes
|
||||||
|
|
||||||
These probes are designed to signal relatively unusual situations within
|
These probes are designed to signal relatively unusual situations within
|
||||||
the virtual memory subsystem of @theglibc{}.
|
the virtual memory subsystem of @theglibc{}. The location and the
|
||||||
|
availability of some probes depend on whether per-thread arenas are
|
||||||
|
enabled (the default) or disabled at the time @theglibc{} is compiled.
|
||||||
|
|
||||||
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
|
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
|
||||||
This probe is triggered when @code{malloc} allocates and initializes an
|
This probe is triggered when @code{malloc} allocates and initializes an
|
||||||
@ -39,3 +41,82 @@ This probe is triggered when function @code{mallopt} is called to change
|
|||||||
the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
|
the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
|
||||||
the ones passed to the @code{mallopt} function.
|
the ones passed to the @code{mallopt} function.
|
||||||
@end deftp
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt_mxfast (int @var{$arg1}, int @var{$arg2})
|
||||||
|
This probe is triggered shortly after the @code{memory_mallopt} probe,
|
||||||
|
when the parameter to be changed is @code{M_MXFAST}, and the requested
|
||||||
|
value is in an acceptable range. Argument @var{$arg1} is the requested
|
||||||
|
value, and @var{$arg2} is the previous value of this @code{malloc}
|
||||||
|
parameter.
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt_trim_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
|
||||||
|
This probe is triggere shortly after the @code{memory_mallopt} probe,
|
||||||
|
when the parameter to be changed is @code{M_TRIM_THRESHOLD}. Argument
|
||||||
|
@var{$arg1} is the requested value, @var{$arg2} is the previous value of
|
||||||
|
this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
|
||||||
|
threshold adjustment was already disabled.
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt_top_pad (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
|
||||||
|
This probe is triggered shortly after the @code{memory_mallopt} probe,
|
||||||
|
when the parameter to be changed is @code{M_TOP_PAD}. Argument
|
||||||
|
@var{$arg1} is the requested value, @var{$arg2} is the previous value of
|
||||||
|
this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
|
||||||
|
threshold adjustment was already disabled.
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt_mmap_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
|
||||||
|
This probe is triggered shortly after the @code{memory_mallopt} probe,
|
||||||
|
when the parameter to be changed is @code{M_MMAP_THRESHOLD}, and the
|
||||||
|
requested value is in an acceptable range. Argument @var{$arg1} is the
|
||||||
|
requested value, @var{$arg2} is the previous value of this @code{malloc}
|
||||||
|
parameter, and @var{$arg3} is nonzero if dynamic threshold adjustment
|
||||||
|
was already disabled.
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt_mmap_max (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
|
||||||
|
This probe is triggered shortly after the @code{memory_mallopt} probe,
|
||||||
|
when the parameter to be changed is @code{M_MMAP_MAX}. Argument
|
||||||
|
@var{$arg1} is the requested value, @var{$arg2} is the previous value of
|
||||||
|
this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
|
||||||
|
threshold adjustment was already disabled.
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt_check_action (int @var{$arg1}, int @var{$arg2})
|
||||||
|
This probe is triggered shortly after the @code{memory_mallopt} probe,
|
||||||
|
when the parameter to be changed is @code{M_CHECK_ACTION}. Argument
|
||||||
|
@var{$arg1} is the requested value, and @var{$arg2} is the previous
|
||||||
|
value of this @code{malloc} parameter.
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt_perturb (int @var{$arg1}, int @var{$arg2})
|
||||||
|
This probe is triggered shortly after the @code{memory_mallopt} probe,
|
||||||
|
when the parameter to be changed is @code{M_PERTURB}. Argument
|
||||||
|
@var{$arg1} is the requested value, and @var{$arg2} is the previous
|
||||||
|
value of this @code{malloc} parameter.
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt_arena_test (int @var{$arg1}, int @var{$arg2})
|
||||||
|
This probe is triggered shortly after the @code{memory_mallopt} probe,
|
||||||
|
when the parameter to be changed is @code{M_ARENA_TEST}, and the
|
||||||
|
requested value is in an acceptable range. Argument @var{$arg1} is the
|
||||||
|
requested value, and @var{$arg2} is the previous value of this
|
||||||
|
@code{malloc} parameter. This probe is only available when per-thread
|
||||||
|
arenas are enabled.
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt_arena_max (int @var{$arg1}, int @var{$arg2})
|
||||||
|
This probe is triggered shortly after the @code{memory_mallopt} probe,
|
||||||
|
when the parameter to be changed is @code{M_ARENA_MAX}, and the
|
||||||
|
requested value is in an acceptable range. Argument @var{$arg1} is the
|
||||||
|
requested value, and @var{$arg2} is the previous value of this
|
||||||
|
@code{malloc} parameter. This probe is only available when per-thread
|
||||||
|
arenas are enabled.
|
||||||
|
@end deftp
|
||||||
|
|
||||||
|
@deftp Probe memory_mallopt_free_dyn_thresholds (int @var{$arg1}, int @var{$arg2})
|
||||||
|
This probe is triggered when function @code{free} decides to adjust the
|
||||||
|
dynamic brk/mmap thresholds. Argument @var{$arg1} and @var{$arg2} are
|
||||||
|
the adjusted mmap and trim thresholds, respectively.
|
||||||
|
@end deftp
|
||||||
|
Reference in New Issue
Block a user