diff options
author | Qi Wang <interwq@gwu.edu> | 2017-11-03 00:48:39 (GMT) |
---|---|---|
committer | Qi Wang <interwq@gmail.com> | 2017-11-03 20:53:33 (GMT) |
commit | e422fa8e7ea749ab8c4783e405c0f4b19ac25db9 (patch) | |
tree | 3c84baa27103dffe0282e597afe4581e6799476d /src/extent.c | |
parent | 9f455e2786685b443201c33119765c8093461174 (diff) | |
download | jemalloc-e422fa8e7ea749ab8c4783e405c0f4b19ac25db9.zip jemalloc-e422fa8e7ea749ab8c4783e405c0f4b19ac25db9.tar.gz jemalloc-e422fa8e7ea749ab8c4783e405c0f4b19ac25db9.tar.bz2 |
Add arena.i.retain_grow_limit
This option controls the max size when grow_retained. This is useful when we
have customized extent hooks reserving physical memory (e.g. 1G huge pages).
Without this feature, the default increasing sequence could result in fragmented
and wasted physical memory.
Diffstat (limited to 'src/extent.c')
-rw-r--r-- | src/extent.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/extent.c b/src/extent.c index 497f4e4..d1324f9 100644 --- a/src/extent.c +++ b/src/extent.c @@ -1284,13 +1284,14 @@ extent_grow_retained(tsdn_t *tsdn, arena_t *arena, } /* - * Increment extent_grow_next if doing so wouldn't exceed the legal + * Increment extent_grow_next if doing so wouldn't exceed the allowed * range. */ - if (arena->extent_grow_next + egn_skip + 1 < NPSIZES) { + if (arena->extent_grow_next + egn_skip + 1 <= + arena->retain_grow_limit) { arena->extent_grow_next += egn_skip + 1; } else { - arena->extent_grow_next = NPSIZES - 1; + arena->extent_grow_next = arena->retain_grow_limit; } /* All opportunities for failure are past. */ malloc_mutex_unlock(tsdn, &arena->extent_grow_mtx); |