Implement opt.metadata_thp

This option enables transparent huge page for base allocators (require
MADV_HUGEPAGE support).
This commit is contained in:
Qi Wang
2017-08-10 13:14:26 -07:00
committed by Qi Wang
parent d157864027
commit 8fdd9a5797
12 changed files with 118 additions and 17 deletions

View File

@@ -1,6 +1,8 @@
#ifndef JEMALLOC_INTERNAL_BASE_EXTERNS_H
#define JEMALLOC_INTERNAL_BASE_EXTERNS_H
extern bool opt_metadata_thp;
base_t *b0get(void);
base_t *base_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks);
void base_delete(tsdn_t *tsdn, base_t *base);

View File

@@ -4,4 +4,6 @@
typedef struct base_block_s base_block_t;
typedef struct base_s base_t;
#define METADATA_THP_DEFAULT false
#endif /* JEMALLOC_INTERNAL_BASE_TYPES_H */

View File

@@ -260,6 +260,12 @@
/* Defined if madvise(2) is available. */
#undef JEMALLOC_HAVE_MADVISE
/*
* Defined if transparent huge pages are supported via the MADV_[NO]HUGEPAGE
* arguments to madvise(2).
*/
#undef JEMALLOC_HAVE_MADVISE_HUGE
/*
* Methods for purging unused pages differ between operating systems.
*

View File

@@ -58,6 +58,9 @@ static const bool pages_can_purge_forced =
#endif
;
/* Whether transparent huge page state is "madvise". */
extern bool thp_state_madvise;
void *pages_map(void *addr, size_t size, size_t alignment, bool *commit);
void pages_unmap(void *addr, size_t size);
bool pages_commit(void *addr, size_t size);