mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-22 21:06:21 +03:00
Implement process_madvise support.
Add opt.process_madvise_max_batch which determines if process_madvise is enabled (non-zero) and the max # of regions in each batch. Added another limiting factor which is the space to reserve on stack, which results in the max batch of 128.
This commit is contained in:
parent
70f019cd3a
commit
22440a0207
13 changed files with 204 additions and 6 deletions
|
|
@ -21,6 +21,16 @@
|
|||
#define LG_EXTENT_MAX_ACTIVE_FIT_DEFAULT 6
|
||||
extern size_t opt_lg_extent_max_active_fit;
|
||||
|
||||
#define PROCESS_MADVISE_MAX_BATCH_DEFAULT 0
|
||||
extern size_t opt_process_madvise_max_batch;
|
||||
|
||||
#ifdef JEMALLOC_HAVE_PROCESS_MADVISE
|
||||
/* The iovec is on stack. Limit the max batch to avoid stack overflow. */
|
||||
#define PROCESS_MADVISE_MAX_BATCH_LIMIT (VARIABLE_ARRAY_SIZE_MAX / sizeof(struct iovec))
|
||||
#else
|
||||
#define PROCESS_MADVISE_MAX_BATCH_LIMIT 0
|
||||
#endif
|
||||
|
||||
edata_t *ecache_alloc(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
|
||||
ecache_t *ecache, edata_t *expand_edata, size_t size, size_t alignment,
|
||||
bool zero, bool guarded);
|
||||
|
|
@ -42,6 +52,8 @@ edata_t *extent_alloc_wrapper(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
|
|||
bool growing_retained);
|
||||
void extent_dalloc_wrapper(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
|
||||
edata_t *edata);
|
||||
void extent_dalloc_wrapper_purged(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
|
||||
edata_t *edata);
|
||||
void extent_destroy_wrapper(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
|
||||
edata_t *edata);
|
||||
bool extent_commit_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
||||
|
|
|
|||
|
|
@ -345,6 +345,9 @@
|
|||
*/
|
||||
#undef JEMALLOC_MADVISE_NOCORE
|
||||
|
||||
/* Defined if process_madvise(2) is available. */
|
||||
#undef JEMALLOC_HAVE_PROCESS_MADVISE
|
||||
|
||||
/* Defined if mprotect(2) is available. */
|
||||
#undef JEMALLOC_HAVE_MPROTECT
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,13 @@ static const bool have_madvise_huge =
|
|||
false
|
||||
#endif
|
||||
;
|
||||
static const bool have_process_madvise =
|
||||
#ifdef JEMALLOC_HAVE_PROCESS_MADVISE
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
;
|
||||
static const bool config_fill =
|
||||
#ifdef JEMALLOC_FILL
|
||||
true
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ bool pages_commit(void *addr, size_t size);
|
|||
bool pages_decommit(void *addr, size_t size);
|
||||
bool pages_purge_lazy(void *addr, size_t size);
|
||||
bool pages_purge_forced(void *addr, size_t size);
|
||||
bool pages_purge_process_madvise(void *vec, size_t ven_len, size_t total_bytes);
|
||||
bool pages_huge(void *addr, size_t size);
|
||||
bool pages_nohuge(void *addr, size_t size);
|
||||
bool pages_collapse(void *addr, size_t size);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@ static inline el_type * \
|
|||
list_type##_last(const list_type##_t *list) { \
|
||||
return ql_last(&list->head, linkage); \
|
||||
} \
|
||||
static inline el_type * \
|
||||
list_type##_next(const list_type##_t *list, el_type *item) { \
|
||||
return ql_next(&list->head, item, linkage); \
|
||||
} \
|
||||
static inline void \
|
||||
list_type##_append(list_type##_t *list, el_type *item) { \
|
||||
ql_elm_new(item, linkage); \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue