Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8276055: ZGC: Defragment address space #6137

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/hotspot/share/gc/z/zMemory.cpp
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ void ZMemoryManager::register_callbacks(const Callbacks& callbacks) {
_callbacks = callbacks;
}

uintptr_t ZMemoryManager::peek_alloc_from_front() const {
uintptr_t ZMemoryManager::peek_low_address() const {
ZLocker<ZLock> locker(&_lock);

const ZMemory* const area = _freelist.first();
@@ -97,7 +97,7 @@ uintptr_t ZMemoryManager::peek_alloc_from_front() const {
return UINTPTR_MAX;
}

uintptr_t ZMemoryManager::alloc_from_front(size_t size) {
uintptr_t ZMemoryManager::alloc_low_address(size_t size) {
ZLocker<ZLock> locker(&_lock);

ZListIterator<ZMemory> iter(&_freelist);
@@ -122,7 +122,7 @@ uintptr_t ZMemoryManager::alloc_from_front(size_t size) {
return UINTPTR_MAX;
}

uintptr_t ZMemoryManager::alloc_from_front_at_most(size_t size, size_t* allocated) {
uintptr_t ZMemoryManager::alloc_low_address_at_most(size_t size, size_t* allocated) {
ZLocker<ZLock> locker(&_lock);

ZMemory* area = _freelist.first();
@@ -148,7 +148,7 @@ uintptr_t ZMemoryManager::alloc_from_front_at_most(size_t size, size_t* allocate
return UINTPTR_MAX;
}

uintptr_t ZMemoryManager::alloc_from_back(size_t size) {
uintptr_t ZMemoryManager::alloc_high_address(size_t size) {
ZLocker<ZLock> locker(&_lock);

ZListReverseIterator<ZMemory> iter(&_freelist);
@@ -172,7 +172,7 @@ uintptr_t ZMemoryManager::alloc_from_back(size_t size) {
return UINTPTR_MAX;
}

uintptr_t ZMemoryManager::alloc_from_back_at_most(size_t size, size_t* allocated) {
uintptr_t ZMemoryManager::alloc_high_address_at_most(size_t size, size_t* allocated) {
ZLocker<ZLock> locker(&_lock);

ZMemory* area = _freelist.last();
10 changes: 5 additions & 5 deletions src/hotspot/share/gc/z/zMemory.hpp
Original file line number Diff line number Diff line change
@@ -82,11 +82,11 @@ class ZMemoryManager {

void register_callbacks(const Callbacks& callbacks);

uintptr_t peek_alloc_from_front() const;
uintptr_t alloc_from_front(size_t size);
uintptr_t alloc_from_front_at_most(size_t size, size_t* allocated);
uintptr_t alloc_from_back(size_t size);
uintptr_t alloc_from_back_at_most(size_t size, size_t* allocated);
uintptr_t peek_low_address() const;
uintptr_t alloc_low_address(size_t size);
uintptr_t alloc_low_address_at_most(size_t size, size_t* allocated);
uintptr_t alloc_high_address(size_t size);
uintptr_t alloc_high_address_at_most(size_t size, size_t* allocated);

void free(uintptr_t start, size_t size);
};
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/z/zPageAllocator.cpp
Original file line number Diff line number Diff line change
@@ -567,7 +567,7 @@ bool ZPageAllocator::should_defragment(const ZPage* page) const {
// a lower address is available.
return page->type() == ZPageTypeSmall &&
page->start() >= _virtual.reserved() / 2 &&
page->start() > _virtual.peek_alloc_low_address();
page->start() > _virtual.lowest_available_address();
}

bool ZPageAllocator::is_alloc_satisfied(ZPageAllocation* allocation) const {
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/z/zPhysicalMemory.cpp
Original file line number Diff line number Diff line change
@@ -295,7 +295,7 @@ void ZPhysicalMemoryManager::alloc(ZPhysicalMemory& pmem, size_t size) {
// Allocate segments
while (size > 0) {
size_t allocated = 0;
const uintptr_t start = _manager.alloc_from_front_at_most(size, &allocated);
const uintptr_t start = _manager.alloc_low_address_at_most(size, &allocated);
assert(start != UINTPTR_MAX, "Allocation should never fail");
pmem.add_segment(ZPhysicalMemorySegment(start, allocated, false /* committed */));
size -= allocated;
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/z/zVirtualMemory.cpp
Original file line number Diff line number Diff line change
@@ -195,9 +195,9 @@ ZVirtualMemory ZVirtualMemoryManager::alloc(size_t size, bool force_low_address)
// Small pages are allocated at low addresses, while medium/large pages
// are allocated at high addresses (unless forced to be at a low address).
if (force_low_address || size <= ZPageSizeSmall) {
start = _manager.alloc_from_front(size);
start = _manager.alloc_low_address(size);
} else {
start = _manager.alloc_from_back(size);
start = _manager.alloc_high_address(size);
}

return ZVirtualMemory(start, size);
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/z/zVirtualMemory.hpp
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ class ZVirtualMemoryManager {
bool is_initialized() const;

size_t reserved() const;
uintptr_t peek_alloc_low_address() const;
uintptr_t lowest_available_address() const;

ZVirtualMemory alloc(size_t size, bool force_low_address);
void free(const ZVirtualMemory& vmem);
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/z/zVirtualMemory.inline.hpp
Original file line number Diff line number Diff line change
@@ -61,8 +61,8 @@ inline size_t ZVirtualMemoryManager::reserved() const {
return _reserved;
}

inline uintptr_t ZVirtualMemoryManager::peek_alloc_low_address() const {
return _manager.peek_alloc_from_front();
inline uintptr_t ZVirtualMemoryManager::lowest_available_address() const {
return _manager.peek_low_address();
}

#endif // SHARE_GC_Z_ZVIRTUALMEMORY_INLINE_HPP