Refactor !opt.munmap to opt.retain.

This commit is contained in:
Jason Evans
2017-04-26 16:26:12 -07:00
parent d901a37775
commit b9ab04a191
16 changed files with 42 additions and 43 deletions

View File

@@ -230,7 +230,7 @@ struct arena_s {
/*
* Next extent size class in a growing series to use when satisfying a
* request via the extent hooks (only if !opt_munmap). This limits the
* request via the extent hooks (only if opt_retain). This limits the
* number of disjoint virtual memory ranges so that extent merging can
* be effective even if multiple arenas' extent allocation requests are
* highly interleaved.

View File

@@ -1,7 +1,7 @@
#ifndef JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H
#define JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H
extern bool opt_munmap;
extern bool opt_retain;
void *extent_alloc_mmap(void *new_addr, size_t size, size_t alignment,
bool *zero, bool *commit);

View File

@@ -59,10 +59,9 @@ struct extent_s {
*
* sn: Serial number (potentially non-unique).
*
* Serial numbers may wrap around if JEMALLOC_MUNMAP is defined, but
* as long as comparison functions fall back on address comparison
* for equal serial numbers, stable (if imperfect) ordering is
* maintained.
* Serial numbers may wrap around if !opt_retain, but as long as
* comparison functions fall back on address comparison for equal
* serial numbers, stable (if imperfect) ordering is maintained.
*
* Serial numbers may not be unique even in the absence of
* wrap-around, e.g. when splitting an extent and assigning the same

View File

@@ -192,12 +192,12 @@
#undef JEMALLOC_MAPS_COALESCE
/*
* If defined, use munmap() to unmap freed extents by default, rather than
* storing them for later reuse. This is disabled on 64-bit Linux because
* If defined, retain memory for later reuse by default rather than using e.g.
* munmap() to unmap freed extents. This is enabled on 64-bit Linux because
* common sequences of mmap()/munmap() calls will cause virtual memory map
* holes.
*/
#undef JEMALLOC_MUNMAP
#undef JEMALLOC_RETAIN
/* TLS is used to map arenas and magazine caches to threads. */
#undef JEMALLOC_TLS

View File

@@ -117,10 +117,9 @@ typedef struct arena_stats_s {
atomic_zu_t mapped; /* Partially derived. */
/*
* Number of bytes currently retained as a side effect of munmap() being
* disabled/bypassed. Retained bytes are technically mapped (though
* always decommitted or purged), but they are excluded from the mapped
* statistic (above).
* Number of unused virtual memory bytes currently retained. Retained
* bytes are technically mapped (though always decommitted or purged),
* but they are excluded from the mapped statistic (above).
*/
atomic_zu_t retained; /* Derived. */