Trim before commit in extent_recycle().

This avoids creating clean committed pages as a side effect of aligned
allocation.  For configurations that decommit memory, purged pages are
decommitted, and decommitted extents cannot be coalesced with committed
extents.  Unless the clean committed pages happen to be selected during
allocation, they cause unnecessary permanent extent fragmentation.

This resolves #766.
This commit is contained in:
Jason Evans 2017-04-19 16:14:54 -07:00
parent acf4c8ae33
commit fed9a880c8
2 changed files with 9 additions and 3 deletions

View file

@ -15,7 +15,9 @@ extent_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero,
return NULL;
}
assert(ret != NULL);
*zero = true;
if (*commit) {
*zero = true;
}
return ret;
}