Implement huge arena: opt.huge_threshold.

The feature allows using a dedicated arena for huge allocations.  We want the
addtional arena to separate huge allocation because: 1) mixing small extents
with huge ones causes fragmentation over the long run (this feature reduces VM
size significantly); 2) with many arenas, huge extents rarely get reused across
threads; and 3) huge allocations happen way less frequently, therefore no
concerns for lock contention.
This commit is contained in:
Qi Wang
2018-05-21 13:33:48 -07:00
committed by Qi Wang
parent 77a71ef2b7
commit 94a88c26f4
8 changed files with 106 additions and 6 deletions

View File

@@ -341,6 +341,9 @@ TEST_BEGIN(test_thread_arena) {
sz = sizeof(unsigned);
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas, &sz, NULL, 0),
0, "Unexpected mallctl() failure");
if (opt_huge_threshold != 0) {
narenas--;
}
assert_u_eq(narenas, opt_narenas, "Number of arenas incorrect");
if (strcmp(opa, "disabled") == 0) {