diff options
author | Dave Watson <davejwatson@fb.com> | 2019-04-08 16:37:58 (GMT) |
---|---|---|
committer | Dave Watson <davejwatson@fb.com> | 2019-05-08 20:15:19 (GMT) |
commit | b62d126df894dac00772eb5f3d170a1c1d3d1614 (patch) | |
tree | 8124406eabb0fe2f181021ed07af173cfc7f4bea | |
parent | 7fc4f2a32c74701e40e98c8ac05aa7cf12d876c9 (diff) | |
download | jemalloc-b62d126df894dac00772eb5f3d170a1c1d3d1614.zip jemalloc-b62d126df894dac00772eb5f3d170a1c1d3d1614.tar.gz jemalloc-b62d126df894dac00772eb5f3d170a1c1d3d1614.tar.bz2 |
Add max_active_fit to first_fit
The max_active_fit check is currently only on the best_fit
path, add it to the first_fit path also.
-rw-r--r-- | src/extent.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/extent.c b/src/extent.c index 66cbf05..c8d1dd5 100644 --- a/src/extent.c +++ b/src/extent.c @@ -483,7 +483,16 @@ extents_first_fit_locked(tsdn_t *tsdn, arena_t *arena, extents_t *extents, assert(!extent_heap_empty(&extents->heaps[i])); extent_t *extent = extent_heap_first(&extents->heaps[i]); assert(extent_size_get(extent) >= size); - if (ret == NULL || extent_snad_comp(extent, ret) < 0) { + bool size_ok = true; + /* + * In order to reduce fragmentation, avoid reusing and splitting + * large extents for much smaller sizes. + */ + if ((sz_pind2sz(i) >> opt_lg_extent_max_active_fit) > size) { + size_ok = false; + } + if (size_ok && + (ret == NULL || extent_snad_comp(extent, ret) < 0)) { ret = extent; } if (i == SC_NPSIZES) { |