aboutsummaryrefslogtreecommitdiffstats
path: root/src/large.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2017-03-08 22:42:57 -0800
committerJason Evans <jasone@canonware.com>2017-03-15 13:13:47 -0700
commit64e458f5cdd64f9b67cb495f177ef96bf3ce4e0e (patch)
treed8b459159a8c1a9b73632945f6517e667d5b9c54 /src/large.c
parent38a5bfc8169b018b5b71cc72daad14c3b2f5b206 (diff)
downloadplatform_external_jemalloc_new-64e458f5cdd64f9b67cb495f177ef96bf3ce4e0e.tar.gz
platform_external_jemalloc_new-64e458f5cdd64f9b67cb495f177ef96bf3ce4e0e.tar.bz2
platform_external_jemalloc_new-64e458f5cdd64f9b67cb495f177ef96bf3ce4e0e.zip
Implement two-phase decay-based purging.
Split decay-based purging into two phases, the first of which uses lazy purging to convert dirty pages to "muzzy", and the second of which uses forced purging, decommit, or unmapping to convert pages to clean or destroy them altogether. Not all operating systems support lazy purging, yet the application may provide extent hooks that implement lazy purging, so care must be taken to dynamically omit the first phase when necessary. The mallctl interfaces change as follows: - opt.decay_time --> opt.{dirty,muzzy}_decay_time - arena.<i>.decay_time --> arena.<i>.{dirty,muzzy}_decay_time - arenas.decay_time --> arenas.{dirty,muzzy}_decay_time - stats.arenas.<i>.pdirty --> stats.arenas.<i>.p{dirty,muzzy} - stats.arenas.<i>.{npurge,nmadvise,purged} --> stats.arenas.<i>.{dirty,muzzy}_{npurge,nmadvise,purged} This resolves #521.
Diffstat (limited to 'src/large.c')
-rw-r--r--src/large.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/large.c b/src/large.c
index 5145f418..c578995c 100644
--- a/src/large.c
+++ b/src/large.c
@@ -125,7 +125,7 @@ large_ralloc_no_move_shrink(tsdn_t *tsdn, extent_t *extent, size_t usize) {
extent_usize_get(trail));
}
- arena_extent_cache_dalloc(tsdn, arena, &extent_hooks, trail);
+ arena_extents_dirty_dalloc(tsdn, arena, &extent_hooks, trail);
}
arena_extent_ralloc_large_shrink(tsdn, arena, extent, oldusize);
@@ -158,9 +158,16 @@ large_ralloc_no_move_expand(tsdn_t *tsdn, extent_t *extent, size_t usize,
bool commit = true;
extent_t *trail;
bool new_mapping;
- if ((trail = extent_alloc_cache(tsdn, arena, &extent_hooks,
- extent_past_get(extent), trailsize, 0, CACHELINE, &is_zeroed_trail,
- &commit, false)) == NULL) {
+ if ((trail = extents_alloc(tsdn, arena, &extent_hooks,
+ &arena->extents_dirty, extent_past_get(extent), trailsize, 0,
+ CACHELINE, &is_zeroed_trail, &commit, false)) != NULL
+ || (trail = extents_alloc(tsdn, arena, &extent_hooks,
+ &arena->extents_muzzy, extent_past_get(extent), trailsize, 0,
+ CACHELINE, &is_zeroed_trail, &commit, false)) != NULL) {
+ if (config_stats) {
+ new_mapping = false;
+ }
+ } else {
if ((trail = extent_alloc_wrapper(tsdn, arena, &extent_hooks,
extent_past_get(extent), trailsize, 0, CACHELINE,
&is_zeroed_trail, &commit, false)) == NULL) {
@@ -169,10 +176,6 @@ large_ralloc_no_move_expand(tsdn_t *tsdn, extent_t *extent, size_t usize,
if (config_stats) {
new_mapping = true;
}
- } else {
- if (config_stats) {
- new_mapping = false;
- }
}
if (extent_merge_wrapper(tsdn, arena, &extent_hooks, extent, trail)) {
@@ -327,7 +330,7 @@ large_dalloc_prep_impl(tsdn_t *tsdn, arena_t *arena, extent_t *extent,
static void
large_dalloc_finish_impl(tsdn_t *tsdn, arena_t *arena, extent_t *extent) {
extent_hooks_t *extent_hooks = EXTENT_HOOKS_INITIALIZER;
- arena_extent_cache_dalloc(tsdn, arena, &extent_hooks, extent);
+ arena_extents_dirty_dalloc(tsdn, arena, &extent_hooks, extent);
}
void