Fix potential VM map fragmentation regression.

Revert 245ae6036c (Support --with-lg-page
values larger than actual page size.), because it could cause VM map
fragmentation if the kernel grows mmap()ed memory downward.

This resolves #391.
This commit is contained in:
Jason Evans 2016-06-07 14:15:49 -07:00
parent de23f6fce7
commit dd752c1ffd
2 changed files with 2 additions and 2 deletions

View File

@ -813,7 +813,7 @@ sa2u(size_t size, size_t alignment)
* Calculate the multi-page mapping that large_palloc() would need in * Calculate the multi-page mapping that large_palloc() would need in
* order to guarantee the alignment. * order to guarantee the alignment.
*/ */
if (usize + large_pad + PAGE_CEILING(alignment) < usize) { if (usize + large_pad + PAGE_CEILING(alignment) - PAGE < usize) {
/* size_t overflow. */ /* size_t overflow. */
return (0); return (0);
} }

View File

@ -9,7 +9,7 @@ extent_alloc_mmap_slow(size_t size, size_t alignment, bool *zero, bool *commit)
void *ret; void *ret;
size_t alloc_size; size_t alloc_size;
alloc_size = size + alignment; alloc_size = size + alignment - PAGE;
/* Beware size_t wrap-around. */ /* Beware size_t wrap-around. */
if (alloc_size < size) if (alloc_size < size)
return (NULL); return (NULL);