3004 bytes_to_release, CALLER_PC); |
3004 bytes_to_release, CALLER_PC); |
3005 os::release_memory(p_buf, bytes_to_release); |
3005 os::release_memory(p_buf, bytes_to_release); |
3006 } |
3006 } |
3007 #ifdef ASSERT |
3007 #ifdef ASSERT |
3008 if (should_inject_error) { |
3008 if (should_inject_error) { |
3009 if (TracePageSizes && Verbose) { |
3009 log_develop_debug(pagesize)("Reserving pages individually failed."); |
3010 tty->print_cr("Reserving pages individually failed."); |
|
3011 } |
|
3012 } |
3010 } |
3013 #endif |
3011 #endif |
3014 return NULL; |
3012 return NULL; |
3015 } |
3013 } |
3016 |
3014 |
3190 |
3188 |
3191 // with large pages, there are two cases where we need to use Individual Allocation |
3189 // with large pages, there are two cases where we need to use Individual Allocation |
3192 // 1) the UseLargePagesIndividualAllocation flag is set (set by default on WS2003) |
3190 // 1) the UseLargePagesIndividualAllocation flag is set (set by default on WS2003) |
3193 // 2) NUMA Interleaving is enabled, in which case we use a different node for each page |
3191 // 2) NUMA Interleaving is enabled, in which case we use a different node for each page |
3194 if (UseLargePagesIndividualAllocation || UseNUMAInterleaving) { |
3192 if (UseLargePagesIndividualAllocation || UseNUMAInterleaving) { |
3195 if (TracePageSizes && Verbose) { |
3193 log_debug(pagesize)("Reserving large pages individually."); |
3196 tty->print_cr("Reserving large pages individually."); |
3194 |
3197 } |
|
3198 char * p_buf = allocate_pages_individually(bytes, addr, flags, prot, LargePagesIndividualAllocationInjectError); |
3195 char * p_buf = allocate_pages_individually(bytes, addr, flags, prot, LargePagesIndividualAllocationInjectError); |
3199 if (p_buf == NULL) { |
3196 if (p_buf == NULL) { |
3200 // give an appropriate warning message |
3197 // give an appropriate warning message |
3201 if (UseNUMAInterleaving) { |
3198 if (UseNUMAInterleaving) { |
3202 warning("NUMA large page allocation failed, UseLargePages flag ignored"); |
3199 warning("NUMA large page allocation failed, UseLargePages flag ignored"); |
3209 } |
3206 } |
3210 |
3207 |
3211 return p_buf; |
3208 return p_buf; |
3212 |
3209 |
3213 } else { |
3210 } else { |
3214 if (TracePageSizes && Verbose) { |
3211 log_debug(pagesize)("Reserving large pages in a single large chunk."); |
3215 tty->print_cr("Reserving large pages in a single large chunk."); |
3212 |
3216 } |
|
3217 // normal policy just allocate it all at once |
3213 // normal policy just allocate it all at once |
3218 DWORD flag = MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES; |
3214 DWORD flag = MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES; |
3219 char * res = (char *)VirtualAlloc(addr, bytes, flag, prot); |
3215 char * res = (char *)VirtualAlloc(addr, bytes, flag, prot); |
3220 if (res != NULL) { |
3216 if (res != NULL) { |
3221 MemTracker::record_virtual_memory_reserve_and_commit((address)res, bytes, CALLER_PC); |
3217 MemTracker::record_virtual_memory_reserve_and_commit((address)res, bytes, CALLER_PC); |