b8947edcb6
a large page size that is greater than malloc(3)'s default chunk size but less than or equal to 4 MB, then increase the chunk size to match the large page size. Most often, using a chunk size that is less than the large page size is not a problem. However, consider a long-running application that allocates and frees significant amounts of memory. In particular, it frees enough memory at times that some of that memory is munmap()ed. Up until the first munmap(), a 1MB chunk size is just fine; it's not a problem for the virtual memory system. Two adjacent 1MB chunks that are aligned on a 2MB boundary will be promoted automatically to a superpage even though they were allocated at different times. The trouble begins with the munmap(), releasing a 1MB chunk will trigger the demotion of the containing superpage, leaving behind a half-used 2MB reservation. Now comes the real problem. Unfortunately, when the application needs to allocate more memory, and it recycles the previously munmap()ed address range, the implementation of mmap() won't be able to reuse the reservation. Basically, the coalescing rules in the virtual memory system don't allow this new range to combine with its neighbor. The effect being that superpage promotion will not reoccur for this range of addresses until both 1MB chunks are freed at some point in the future. Reviewed by: jasone MFC after: 3 weeks |
||
---|---|---|
.. | ||
_Exit.c | ||
a64l.3 | ||
a64l.c | ||
abort.3 | ||
abort.c | ||
abs.3 | ||
abs.c | ||
alloca.3 | ||
atexit.3 | ||
atexit.c | ||
atexit.h | ||
atof.3 | ||
atof.c | ||
atoi.3 | ||
atoi.c | ||
atol.3 | ||
atol.c | ||
atoll.c | ||
bsearch.3 | ||
bsearch.c | ||
div.3 | ||
div.c | ||
exit.3 | ||
exit.c | ||
getenv.3 | ||
getenv.c | ||
getopt_long.3 | ||
getopt_long.c | ||
getopt.3 | ||
getopt.c | ||
getsubopt.3 | ||
getsubopt.c | ||
hcreate.3 | ||
hcreate.c | ||
heapsort.c | ||
imaxabs.3 | ||
imaxabs.c | ||
imaxdiv.3 | ||
imaxdiv.c | ||
insque.3 | ||
insque.c | ||
l64a.c | ||
labs.3 | ||
labs.c | ||
ldiv.3 | ||
ldiv.c | ||
llabs.3 | ||
llabs.c | ||
lldiv.3 | ||
lldiv.c | ||
lsearch.3 | ||
lsearch.c | ||
Makefile.inc | ||
malloc.3 | ||
malloc.c | ||
memory.3 | ||
merge.c | ||
posix_memalign.3 | ||
ptsname.3 | ||
ptsname.c | ||
qsort_r.c | ||
qsort.3 | ||
qsort.c | ||
radixsort.3 | ||
radixsort.c | ||
rand.3 | ||
rand.c | ||
random.3 | ||
random.c | ||
rb.h | ||
reallocf.c | ||
realpath.3 | ||
realpath.c | ||
remque.c | ||
strfmon.3 | ||
strfmon.c | ||
strtod.3 | ||
strtoimax.c | ||
strtol.3 | ||
strtol.c | ||
strtoll.c | ||
strtonum.3 | ||
strtonum.c | ||
strtoq.c | ||
strtoul.3 | ||
strtoul.c | ||
strtoull.c | ||
strtoumax.c | ||
strtouq.c | ||
Symbol.map | ||
system.3 | ||
system.c | ||
tdelete.c | ||
tfind.c | ||
tsearch.3 | ||
tsearch.c | ||
twalk.c |