mmap_cache: add function to enable mmap_cache
mmap_cache was enabled indirectly via unwind feature. As now mmap_cache can be used by other part of strace, a way to enable mmap_cache directly is needed. * defs.h (mmap_cache_enable, mmap_cache_is_enabled): New function prototypes. * mmap_cache.c (use_mmap_cache): New file local variable. (mmap_cache_enable, mmap_cache_is_enabled): New functions. * syscall.c (syscall_exiting_decode): Use mmap_cache_is_enabled() instead of stack_trace_enabled. * unwind.c (unwind_init): Invoke mmap_cache_enable. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
This commit is contained in:
parent
7f041ed0d9
commit
c4e4ca97bc
2
defs.h
2
defs.h
@ -756,6 +756,8 @@ enum mmap_cache_rebuild_result {
|
||||
MMAP_CACHE_REBUILD_RENEWED,
|
||||
};
|
||||
|
||||
extern void mmap_cache_enable(void);
|
||||
extern bool mmap_cache_is_enabled(void);
|
||||
extern void mmap_cache_invalidate(struct tcb *tcp);
|
||||
extern void mmap_cache_delete(struct tcb *tcp, const char *caller);
|
||||
extern enum mmap_cache_rebuild_result mmap_cache_rebuild_if_invalid(struct tcb *tcp, const char *caller);
|
||||
|
11
mmap_cache.c
11
mmap_cache.c
@ -41,6 +41,17 @@
|
||||
#endif
|
||||
|
||||
static unsigned int mmap_cache_generation;
|
||||
static bool use_mmap_cache;
|
||||
|
||||
extern void mmap_cache_enable(void)
|
||||
{
|
||||
use_mmap_cache = true;
|
||||
}
|
||||
|
||||
extern bool mmap_cache_is_enabled(void)
|
||||
{
|
||||
return use_mmap_cache;
|
||||
}
|
||||
|
||||
/*
|
||||
* caching of /proc/ID/maps for each process to speed up stack tracing
|
||||
|
@ -728,12 +728,10 @@ syscall_exiting_decode(struct tcb *tcp, struct timeval *ptv)
|
||||
if ((Tflag || cflag) && !(filtered(tcp) || hide_log(tcp)))
|
||||
gettimeofday(ptv, NULL);
|
||||
|
||||
#ifdef USE_LIBUNWIND
|
||||
if (stack_trace_enabled) {
|
||||
if (mmap_cache_is_enabled()) {
|
||||
if (tcp->s_ent->sys_flags & STACKTRACE_INVALIDATE_CACHE)
|
||||
mmap_cache_invalidate(tcp);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (filtered(tcp) || hide_log(tcp))
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user