diff options
author | Qi Wang <interwq@gwu.edu> | 2017-11-08 21:59:21 (GMT) |
---|---|---|
committer | Qi Wang <interwq@gmail.com> | 2017-11-09 00:33:30 (GMT) |
commit | b5d071c26697813bcceae320ba88dee2a2a73e51 (patch) | |
tree | 2846075de7523d98ba80369ca01cc3f64d21327c /src/extent.c | |
parent | 6dd5681ab787b4153ad2fa425be72efece42d3c7 (diff) | |
download | jemalloc-b5d071c26697813bcceae320ba88dee2a2a73e51.zip jemalloc-b5d071c26697813bcceae320ba88dee2a2a73e51.tar.gz jemalloc-b5d071c26697813bcceae320ba88dee2a2a73e51.tar.bz2 |
Fix unbounded increase in stash_decayed.
Added an upper bound on how many pages we can decay during the current run.
Without this, decay could have unbounded increase in stashed, since other
threads could add new pages into the extents.
Diffstat (limited to 'src/extent.c')
-rw-r--r-- | src/extent.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/extent.c b/src/extent.c index d1324f9..c8a3090 100644 --- a/src/extent.c +++ b/src/extent.c @@ -472,7 +472,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) { + extents_t *extents, size_t npages_min, size_t npages_max) { rtree_ctx_t rtree_ctx_fallback; rtree_ctx_t *rtree_ctx = tsdn_rtree_ctx(tsdn, &rtree_ctx_fallback); @@ -493,7 +493,8 @@ extents_evict(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks, 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) { + if (extents_npages - npages < npages_min || + npages > npages_max) { extent = NULL; goto label_return; } |