8013651: NMT: reserve/release sequence id's in incorrect order due to race

Fixed NMT race condition for realloc, uncommit and release

Reviewed-by: coleenp, ccheung
This commit is contained in:
Zhengyu Gu 2013-06-18 08:44:08 -04:00
parent 87505d60f6
commit 61a30f035b
14 changed files with 464 additions and 252 deletions

View file

@ -753,8 +753,7 @@ static char* mmap_create_shared(size_t size) {
(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);
MemTracker::record_virtual_memory_reserve((address)mapAddress, size, mtInternal, CURRENT_PC);
return mapAddress;
}
@ -919,8 +918,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
}
// 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);
MemTracker::record_virtual_memory_reserve((address)mapAddress, size, mtInternal, CURRENT_PC);
*addr = mapAddress;
*sizep = size;