From 866231fc6166b9c937ce071c5717844998a51413 Mon Sep 17 00:00:00 2001 From: Yinan Zhang Date: Mon, 24 Aug 2020 20:56:34 -0700 Subject: [PATCH] Do not repeat reentrancy test in profiling --- include/jemalloc/internal/prof_inlines.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/jemalloc/internal/prof_inlines.h b/include/jemalloc/internal/prof_inlines.h index 3d0bd14a..62c56832 100644 --- a/include/jemalloc/internal/prof_inlines.h +++ b/include/jemalloc/internal/prof_inlines.h @@ -1,5 +1,5 @@ -#ifndef JEMALLOC_INTERNAL_PROF_INLINES_B_H -#define JEMALLOC_INTERNAL_PROF_INLINES_B_H +#ifndef JEMALLOC_INTERNAL_PROF_INLINES_H +#define JEMALLOC_INTERNAL_PROF_INLINES_H #include "jemalloc/internal/safety_check.h" #include "jemalloc/internal/sz.h" @@ -115,9 +115,12 @@ prof_sample_should_skip(tsd_t *tsd, bool sample_event) { return true; } - if (tsd_reentrancy_level_get(tsd) > 0) { - return true; - } + /* + * sample_event is always obtained from the thread event module, and + * whenever it's true, it means that the thread event module has + * already checked the reentrancy level. + */ + assert(tsd_reentrancy_level_get(tsd) == 0); prof_tdata_t *tdata = prof_tdata_get(tsd, true); if (unlikely(tdata == NULL)) { @@ -255,4 +258,4 @@ prof_free(tsd_t *tsd, const void *ptr, size_t usize, } } -#endif /* JEMALLOC_INTERNAL_PROF_INLINES_B_H */ +#endif /* JEMALLOC_INTERNAL_PROF_INLINES_H */