7199092: NMT: NMT needs to deal overlapped virtual memory ranges

Enhanced virtual memory tracking to track committed regions as well as reserved regions, so NMT now can generate virtual memory map.

Reviewed-by: acorn, coleenp
This commit is contained in:
Zhengyu Gu 2012-10-19 21:40:07 -04:00
parent 240b5c9329
commit 3e481cdd81
29 changed files with 800 additions and 364 deletions

View file

@ -30,6 +30,7 @@
#include "os_bsd.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/perfMemory.hpp"
#include "services/memTracker.hpp"
#include "utilities/exceptions.hpp"
// put OS-includes here
@ -753,6 +754,10 @@ static char* mmap_create_shared(size_t size) {
// clear the shared memory region
(void)::memset((void*) mapAddress, 0, size);
// it does not go through os api, the operation has to record from here
MemTracker::record_virtual_memory_reserve((address)mapAddress, size, CURRENT_PC);
MemTracker::record_virtual_memory_type((address)mapAddress, mtInternal);
return mapAddress;
}
@ -912,6 +917,10 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
"Could not map PerfMemory");
}
// it does not go through os api, the operation has to record from here
MemTracker::record_virtual_memory_reserve((address)mapAddress, size, CURRENT_PC);
MemTracker::record_virtual_memory_type((address)mapAddress, mtInternal);
*addr = mapAddress;
*sizep = size;