mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-03 10:44:16 +03:00
Add config option limit-usize-gap and runtime option limit_usize_gap.
Adding a build-time config option (--enable-limit-usize-gap) and a runtime one (limit_usize_gap) to guard the changes. When build-time config is enabled, some minor CPU overhead is expected because usize will be stored and accessed apart from index. When runtime option is also enabled (it can only be enabled with the build-time config enabled). a new usize calculation approach wil be employed. This new calculation will ceil size to the closest multiple of PAGE for all sizes larger than USIZE_GROW_SLOW_THRESHOLD instead of using the size classes.
This commit is contained in:
parent
c17bf8b368
commit
eac4163a95
8 changed files with 60 additions and 0 deletions
|
|
@ -475,6 +475,12 @@
|
|||
/* If defined, use __int128 for optimization. */
|
||||
#undef JEMALLOC_HAVE_INT128
|
||||
|
||||
/*
|
||||
* If defined, the gap between any two contiguous usizes should not exceed
|
||||
* PAGE.
|
||||
*/
|
||||
#undef LIMIT_USIZE_GAP
|
||||
|
||||
#include "jemalloc/internal/jemalloc_internal_overrides.h"
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ extern atomic_zu_t zero_realloc_count;
|
|||
extern bool opt_cache_oblivious;
|
||||
extern unsigned opt_debug_double_free_max_scan;
|
||||
extern size_t opt_calloc_madvise_threshold;
|
||||
extern bool opt_limit_usize_gap;
|
||||
|
||||
extern const char *opt_malloc_conf_symlink;
|
||||
extern const char *opt_malloc_conf_env_var;
|
||||
|
|
|
|||
|
|
@ -276,4 +276,12 @@ static const bool have_memcntl =
|
|||
#endif
|
||||
;
|
||||
|
||||
static const bool config_limit_usize_gap =
|
||||
#ifdef LIMIT_USIZE_GAP
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
;
|
||||
|
||||
#endif /* JEMALLOC_PREAMBLE_H */
|
||||
|
|
|
|||
|
|
@ -54,6 +54,15 @@ extern size_t sz_large_pad;
|
|||
|
||||
extern void sz_boot(const sc_data_t *sc_data, bool cache_oblivious);
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE bool
|
||||
sz_limit_usize_gap_enabled() {
|
||||
#ifdef LIMIT_USIZE_GAP
|
||||
return opt_limit_usize_gap;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE pszind_t
|
||||
sz_psz2ind(size_t psz) {
|
||||
assert(psz > 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue