summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2009-09-26 18:20:40 +0000
committeralc <alc@FreeBSD.org>2009-09-26 18:20:40 +0000
commit8b80b6e6e761794cd19b2c92d23251e4b983b1b4 (patch)
tree93d939fc35cfb91293f7b3b04c98e2c2e90c69a7 /sys/nfsserver
parentaedd167c2c47b4c7a8ca82f05cfc995fdf0b9696 (diff)
downloadFreeBSD-src-8b80b6e6e761794cd19b2c92d23251e4b983b1b4.zip
FreeBSD-src-8b80b6e6e761794cd19b2c92d23251e4b983b1b4.tar.gz
Make malloc(3) superpage aware. Specifically, if getpagesizes(3) returns
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
Diffstat (limited to 'sys/nfsserver')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud