8252513: ZGC: Contiguous memory reservation probing is broken for TB heap sizes
Reviewed-by: eosterlund, pliden
This commit is contained in:
parent
553f3b1497
commit
ac2b1ae5e2
@ -101,10 +101,10 @@ size_t ZVirtualMemoryManager::reserve_discontiguous(size_t size) {
|
|||||||
|
|
||||||
bool ZVirtualMemoryManager::reserve_contiguous(size_t size) {
|
bool ZVirtualMemoryManager::reserve_contiguous(size_t size) {
|
||||||
// Allow at most 8192 attempts spread evenly across [0, ZAddressOffsetMax)
|
// Allow at most 8192 attempts spread evenly across [0, ZAddressOffsetMax)
|
||||||
const size_t end = ZAddressOffsetMax - size;
|
const size_t unused = ZAddressOffsetMax - size;
|
||||||
const size_t increment = align_up(end / 8192, ZGranuleSize);
|
const size_t increment = MAX2(align_up(unused / 8192, ZGranuleSize), ZGranuleSize);
|
||||||
|
|
||||||
for (size_t start = 0; start <= end; start += increment) {
|
for (size_t start = 0; start + size <= ZAddressOffsetMax; start += increment) {
|
||||||
if (reserve_contiguous_platform(start, size)) {
|
if (reserve_contiguous_platform(start, size)) {
|
||||||
// Make the address range free
|
// Make the address range free
|
||||||
_manager.free(start, size);
|
_manager.free(start, size);
|
||||||
|
Loading…
Reference in New Issue
Block a user