Add pages_dontdump and pages_dodump.

This will, eventually, enable us to avoid dumping eden regions.
This commit is contained in:
David Goldblatt 2017-09-18 15:10:01 -07:00 committed by David Goldblatt
parent ccd09050aa
commit bbaa72422b
2 changed files with 25 additions and 0 deletions

View File

@ -69,6 +69,8 @@ bool pages_purge_lazy(void *addr, size_t size);
bool pages_purge_forced(void *addr, size_t size); bool pages_purge_forced(void *addr, size_t size);
bool pages_huge(void *addr, size_t size); bool pages_huge(void *addr, size_t size);
bool pages_nohuge(void *addr, size_t size); bool pages_nohuge(void *addr, size_t size);
bool pages_dontdump(void *addr, size_t size);
bool pages_dodump(void *addr, size_t size);
bool pages_boot(void); bool pages_boot(void);
#endif /* JEMALLOC_INTERNAL_PAGES_EXTERNS_H */ #endif /* JEMALLOC_INTERNAL_PAGES_EXTERNS_H */

View File

@ -328,6 +328,29 @@ pages_nohuge(void *addr, size_t size) {
#endif #endif
} }
bool
pages_dontdump(void *addr, size_t size) {
assert(PAGE_ADDR2BASE(addr) == addr);
assert(PAGE_CEILING(size) == size);
#ifdef JEMALLOC_MADVISE_DONTDUMP
return madvise(addr, size, MADV_DONTDUMP) != 0;
#else
return false;
#endif
}
bool
pages_dodump(void *addr, size_t size) {
assert(PAGE_ADDR2BASE(addr) == addr);
assert(PAGE_CEILING(size) == size);
#ifdef JEMALLOC_MADVISE_DONTDUMP
return madvise(addr, size, MADV_DODUMP) != 0;
#else
return false;
#endif
}
static size_t static size_t
os_page_detect(void) { os_page_detect(void) {
#ifdef _WIN32 #ifdef _WIN32