aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2017-12-08 12:13:50 -0800
committerQi Wang <interwq@gmail.com>2017-12-18 12:57:07 -0800
commit740bdd68b1d4b9c39c68432e06deb70ad4da3210 (patch)
tree0424df6e414f9e5c03fa50623572da38955b18ca
parentf70785de91ee14e8034f9bd64bf6590199c89e65 (diff)
downloadplatform_external_jemalloc_new-740bdd68b1d4b9c39c68432e06deb70ad4da3210.tar.gz
platform_external_jemalloc_new-740bdd68b1d4b9c39c68432e06deb70ad4da3210.tar.bz2
platform_external_jemalloc_new-740bdd68b1d4b9c39c68432e06deb70ad4da3210.zip
Over purge by 1 extent always.
When purging, large allocations are usually the ones that cross the npages_limit threshold, simply because they are "large". This means we often leave the large extent around for a while, which has the downsides of: 1) high RSS and 2) more chance of them getting fragmented. Given that they are not likely to be reused very soon (LRU), let's over purge by 1 extent (which is often large and not reused frequently).
-rw-r--r--include/jemalloc/internal/extent_externs.h3
-rw-r--r--src/arena.c4
-rw-r--r--src/extent.c6
3 files changed, 5 insertions, 8 deletions
diff --git a/include/jemalloc/internal/extent_externs.h b/include/jemalloc/internal/extent_externs.h
index a76d4e4a..b8a4d026 100644
--- a/include/jemalloc/internal/extent_externs.h
+++ b/include/jemalloc/internal/extent_externs.h
@@ -38,8 +38,7 @@ extent_t *extents_alloc(tsdn_t *tsdn, arena_t *arena,
void extents_dalloc(tsdn_t *tsdn, arena_t *arena,
extent_hooks_t **r_extent_hooks, extents_t *extents, extent_t *extent);
extent_t *extents_evict(tsdn_t *tsdn, arena_t *arena,
- extent_hooks_t **r_extent_hooks, extents_t *extents, size_t npages_min,
- size_t npages_max);
+ extent_hooks_t **r_extent_hooks, extents_t *extents, size_t npages_min);
void extents_prefork(tsdn_t *tsdn, extents_t *extents);
void extents_postfork_parent(tsdn_t *tsdn, extents_t *extents);
void extents_postfork_child(tsdn_t *tsdn, extents_t *extents);
diff --git a/src/arena.c b/src/arena.c
index e2462bf7..a28dbfb0 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -912,7 +912,7 @@ arena_stash_decayed(tsdn_t *tsdn, arena_t *arena,
extent_t *extent;
while (nstashed < npages_decay_max &&
(extent = extents_evict(tsdn, arena, r_extent_hooks, extents,
- npages_limit, npages_decay_max - nstashed)) != NULL) {
+ npages_limit)) != NULL) {
extent_list_append(decay_extents, extent);
nstashed += extent_size_get(extent) >> LG_PAGE;
}
@@ -1226,7 +1226,7 @@ arena_destroy_retained(tsdn_t *tsdn, arena_t *arena) {
extent_hooks_t *extent_hooks = extent_hooks_get(arena);
extent_t *extent;
while ((extent = extents_evict(tsdn, arena, &extent_hooks,
- &arena->extents_retained, 0, SIZE_MAX)) != NULL) {
+ &arena->extents_retained, 0)) != NULL) {
extent_destroy_wrapper(tsdn, arena, &extent_hooks, extent);
}
}
diff --git a/src/extent.c b/src/extent.c
index c531da24..bca703fc 100644
--- a/src/extent.c
+++ b/src/extent.c
@@ -481,7 +481,7 @@ extents_dalloc(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks,
extent_t *
extents_evict(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks,
- extents_t *extents, size_t npages_min, size_t npages_max) {
+ extents_t *extents, size_t npages_min) {
rtree_ctx_t rtree_ctx_fallback;
rtree_ctx_t *rtree_ctx = tsdn_rtree_ctx(tsdn, &rtree_ctx_fallback);
@@ -499,11 +499,9 @@ extents_evict(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks,
goto label_return;
}
/* Check the eviction limit. */
- size_t npages = extent_size_get(extent) >> LG_PAGE;
size_t extents_npages = atomic_load_zu(&extents->npages,
ATOMIC_RELAXED);
- if (extents_npages - npages < npages_min ||
- npages > npages_max) {
+ if (extents_npages <= npages_min) {
extent = NULL;
goto label_return;
}