Optimize max_active_fit in first_fit.

Stop scanning once reached the first max_active_fit size.
This commit is contained in:
Qi Wang 2019-07-23 12:49:17 -07:00 committed by Qi Wang
parent 4e36ce34c1
commit 1d148f353a

View File

@ -453,7 +453,6 @@ 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);
bool size_ok = true;
/*
* In order to reduce fragmentation, avoid reusing and splitting
* large extents for much smaller sizes.
@ -462,10 +461,9 @@ extents_first_fit_locked(tsdn_t *tsdn, arena_t *arena, extents_t *extents,
*/
if (extents->delay_coalesce &&
(sz_pind2sz(i) >> opt_lg_extent_max_active_fit) > size) {
size_ok = false;
break;
}
if (size_ok &&
(ret == NULL || extent_snad_comp(extent, ret) < 0)) {
if (ret == NULL || extent_snad_comp(extent, ret) < 0) {
ret = extent;
}
if (i == SC_NPSIZES) {